OSDN Git Service

#34706 メモリ不足時に演奏したときに強制終了しないよう、いくつかの例外処理を強化した。(DirectSoundのシークエラー処理など)
authoryyagi <yyagi@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Sun, 14 Dec 2014 18:26:55 +0000 (18:26 +0000)
committeryyagi <yyagi@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Sun, 14 Dec 2014 18:26:55 +0000 (18:26 +0000)
git-svn-id: http://svn.osdn.jp/svnroot/dtxmania/trunk@778 16f42ceb-6dc6-49c8-ba94-f2d53467949d

DTXManiaプロジェクト/コード/ステージ/07.演奏/CAct演奏AVI.cs
DTXManiaプロジェクト/コード/ステージ/07.演奏/CAct演奏BGA.cs
DTXManiaプロジェクト/コード/全体/CConfigIni.cs
FDK17プロジェクト/コード/03.サウンド/CSound.cs
実行時フォルダ(DTXCreator)/dll/FDK.dll
実行時フォルダ/DTXManiaGR.exe
実行時フォルダ/dll/FDK.dll

index 89ea0d0..6c0573b 100644 (file)
@@ -354,12 +354,20 @@ namespace DTXMania
                                        355,\r
                                        CDTXMania.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Default, Usage.Dynamic );\r
 #else\r
-                               this.tx描画用 = new CTexture( CDTXMania.app.Device,\r
-                                       //(bIsPreviewMovie)? 204 : 278,\r
-                                       //(bIsPreviewMovie)? 269 : 355,\r
-                                       ( bIsPreviewMovie ) ? 204 : SampleFramework.GameWindowSize.Width,\r
-                                       ( bIsPreviewMovie ) ? 269 : SampleFramework.GameWindowSize.Height,\r
-                                       CDTXMania.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Managed );\r
+                               try\r
+                               {\r
+                                       this.tx描画用 = new CTexture( CDTXMania.app.Device,\r
+                                               //(bIsPreviewMovie)? 204 : 278,\r
+                                               //(bIsPreviewMovie)? 269 : 355,\r
+                                               ( bIsPreviewMovie ) ? 204 : SampleFramework.GameWindowSize.Width,\r
+                                               ( bIsPreviewMovie ) ? 269 : SampleFramework.GameWindowSize.Height,\r
+                                               CDTXMania.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Managed );\r
+                               }\r
+                               catch ( CTextureCreateFailedException e )\r
+                               {\r
+                                       Trace.TraceError( "CActAVI: OnManagedリソースの作成(): " + e.Message );\r
+                                       this.tx描画用 = null;\r
+                               }\r
 #endif\r
                                this.tx描画用.vc拡大縮小倍率 = new Vector3( Scale.X, Scale.Y, 1f );\r
                                //this.tx描画用.vc拡大縮小倍率 = new Vector3( 2f, 2f, 1f );\r
index e5371f8..558de3b 100644 (file)
@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Text;\r
 using System.Runtime.InteropServices;\r
 using System.Drawing;\r
+using System.Diagnostics;\r
 using SlimDX.Direct3D9;\r
 using SlimDX;\r
 using FDK;\r
@@ -133,7 +134,14 @@ namespace DTXMania
                        {\r
                                using( Surface surface = CDTXMania.app.Device.GetBackBuffer( 0, 0 ) )\r
                                {\r
-                                       this.sfBackBuffer = Surface.CreateOffscreenPlain( CDTXMania.app.Device, surface.Description.Width, surface.Description.Height, surface.Description.Format, Pool.SystemMemory );\r
+                                       try\r
+                                       {\r
+                                               this.sfBackBuffer = Surface.CreateOffscreenPlain( CDTXMania.app.Device, surface.Description.Width, surface.Description.Height, surface.Description.Format, Pool.SystemMemory );\r
+                                       }\r
+                                       catch ( Direct3D9Exception e )\r
+                                       {\r
+                                               Trace.TraceError( "CAct演奏BGA: Error: ( " + e.Message + " )" );\r
+                                       }\r
                                }\r
                                base.OnManagedリソースの作成();\r
                        }\r
index 82359f1..06daa07 100644 (file)
@@ -667,7 +667,8 @@ namespace DTXMania
                }\r
                public STAUTOPLAY bAutoPlay;\r
                public int nSoundDeviceType;                            // #24820 2012.12.23 yyagi 出力サウンドデバイス(0=ACM(にしたいが設計がきつそうならDirectShow), 1=ASIO, 2=WASAPI)\r
-//             public int nWASAPIBufferSizeMs;                         // #24820 2013.1.15 yyagi WASAPIのバッファサイズ\r
+               public int nWASAPIBufferSizeMs;                         // #24820 2013.1.15 yyagi WASAPIのバッファサイズ\r
+               public bool bWASAPIBufferAutoSet;\r
 //             public int nASIOBufferSizeMs;                           // #24820 2012.12.28 yyagi ASIOのバッファサイズ\r
                public int nASIODevice;                                         // #24820 2013.1.17 yyagi ASIOデバイス\r
                public bool bUseOSTimer;                                        // #33689 2014.6.6 yyagi 演奏タイマーの種類\r
@@ -1347,12 +1348,12 @@ namespace DTXMania
                        sw.WriteLine( "SoundDeviceType={0}", (int) this.nSoundDeviceType );\r
                        sw.WriteLine();\r
 \r
-                       //sw.WriteLine( "; WASAPI使用時のサウンドバッファサイズ" );\r
-                       //sw.WriteLine( "; (0=デバイスに設定されている値を使用, 1~9999=バッファサイズ(単位:ms)の手動指定" );\r
-                       //sw.WriteLine( "; WASAPI Sound Buffer Size." );\r
-                       //sw.WriteLine( "; (0=Use system default buffer size, 1-9999=specify the buffer size(ms) by yourself)" );\r
-                       //sw.WriteLine( "WASAPIBufferSizeMs={0}", (int) this.nWASAPIBufferSizeMs );\r
-                       //sw.WriteLine();\r
+                       sw.WriteLine( "; WASAPI使用時のサウンドバッファサイズ" );\r
+                       sw.WriteLine( "; (0=デバイスに設定されている値を使用, 1~9999=バッファサイズ(単位:ms)の手動指定" );\r
+                       sw.WriteLine( "; WASAPI Sound Buffer Size." );\r
+                       sw.WriteLine( "; (0=Use system default buffer size, 1-9999=specify the buffer size(ms) by yourself)" );\r
+                       sw.WriteLine( "WASAPIBufferSizeMs={0}", (int) this.nWASAPIBufferSizeMs );\r
+                       sw.WriteLine();\r
 \r
                        sw.WriteLine( "; ASIO使用時のサウンドデバイス" );\r
                        sw.WriteLine( "; 存在しないデバイスを指定すると、DTXManiaが起動しないことがあります。" );\r
index a7a1b97..e0c659a 100644 (file)
@@ -118,7 +118,7 @@ namespace FDK
                #region [ WASAPI/ASIO/DirectSound設定値 ]\r
                /// <summary>\r
                /// <para>WASAPI 排他モード出力における再生遅延[ms](の希望値)。最終的にはこの数値を基にドライバが決定する)。</para>\r
-               /// <para>→ WASAPI初期化時に自動設定するようにしたため、ここで設定した値は使用しないようになった。</para>\r
+               /// <para>0以下の値を指定すると、この数値はWASAPI初期化時に自動設定する。正数を指定すると、その値を設定しようと試みる。</para>\r
                /// </summary>\r
                public static int SoundDelayExclusiveWASAPI = 0;                // SSTでは、50ms\r
                public int GetSoundExclusiveWASAPI()\r
@@ -1220,7 +1220,14 @@ Debug.WriteLine("更に再生に失敗: " + Path.GetFileName(this.strファイ
                        else if( this.bDirectSoundである )\r
                        {\r
                                int n位置sample = (int) ( this.Buffer.Format.SamplesPerSecond * n位置ms * 0.001 * _db周波数倍率 * _db再生速度 );   // #30839 2013.2.24 yyagi; add _db周波数倍率 and _db再生速度\r
-                               this.Buffer.CurrentPlayPosition = n位置sample * this.Buffer.Format.BlockAlignment;\r
+                               try\r
+                               {\r
+                                       this.Buffer.CurrentPlayPosition = n位置sample * this.Buffer.Format.BlockAlignment;\r
+                               }\r
+                               catch ( DirectSoundException e )\r
+                               {\r
+                                       Trace.TraceError( "{0}: Seek error: {1}", Path.GetFileName( this.strファイル名 ), n位置ms, e.Message );\r
+                               }\r
                        }\r
                }\r
 \r
index 91815ce..ed47459 100644 (file)
Binary files a/実行時フォルダ(DTXCreator)/dll/FDK.dll and b/実行時フォルダ(DTXCreator)/dll/FDK.dll differ
index d107fe1..459d067 100644 (file)
Binary files a/実行時フォルダ/DTXManiaGR.exe and b/実行時フォルダ/DTXManiaGR.exe differ
index 91815ce..ed47459 100644 (file)
Binary files a/実行時フォルダ/dll/FDK.dll and b/実行時フォルダ/dll/FDK.dll differ