this.list項目リスト.Add(this.iSystemSoundType);\r
\r
// #24820 2013.1.15 yyagi\r
- //this.iSystemWASAPIBufferSizeMs = new CItemInteger( "WASAPIBufSize", 0, 99999, CDTXMania.ConfigIni.nWASAPIBufferSizeMs,\r
- // "WASAPI使用時のバッファサイズ:\n" +\r
- // "0~99999ms を指定可能です。\n" +\r
- // "0を指定すると、OSがバッファの\n" +\r
- // "サイズを自動設定します。\n" +\r
- // "値を小さくするほど発音ラグが\n" +\r
- // "減少しますが、音割れや異常動作を\n" +\r
- // "引き起こす場合があります。\n" +\r
- // "※ 設定はCONFIGURATION画面の\n" +\r
- // " 終了時に有効になります。",\r
- // "Sound buffer size for WASAPI:\n" +\r
- // "You can set from 0 to 99999ms.\n" +\r
- // "Set 0 to use a default sysytem\n" +\r
- // "buffer size.\n" +\r
- // "Smaller value makes smaller lag,\n" +\r
- // "but it may cause sound troubles.\n" +\r
- // "\n" +\r
- // "Note: Exit CONFIGURATION to make\n" +\r
- // " the setting take effect." );\r
- //this.list項目リスト.Add( this.iSystemWASAPIBufferSizeMs );\r
+ this.iSystemWASAPIBufferSizeMs = new CItemInteger( "WASAPIBufSize", 0, 99999, CDTXMania.ConfigIni.nWASAPIBufferSizeMs,\r
+ "WASAPI使用時のバッファサイズ:\n" +\r
+ "0~99999ms を指定可能です。\n" +\r
+ "0を指定すると、設定可能な最小\n" +\r
+ "サイズを自動設定します。\n" +\r
+ "値を小さくするほど発音ラグが\n" +\r
+ "減少しますが、音割れや異常動作を\n" +\r
+ "引き起こす場合があります。\n" +\r
+ "※ 設定はCONFIGURATION画面の\n" +\r
+ " 終了時に有効になります。",\r
+ "Sound buffer size for WASAPI:\n" +\r
+ "You can set from 0 to 99999ms.\n" +\r
+ "Set 0 to use a minimum buffer\n" +\r
+ "size.\n" +\r
+ "Smaller value makes smaller lag,\n" +\r
+ "but it may cause sound troubles.\n" +\r
+ "\n" +\r
+ "Note: Exit CONFIGURATION to make\n" +\r
+ " the setting take effect." );\r
+ this.list項目リスト.Add( this.iSystemWASAPIBufferSizeMs );\r
\r
// #24820 2013.1.17 yyagi\r
string[] asiodevs = CEnumerateAllAsioDevices.GetAllASIODevices();\r
this.ct三角矢印アニメ = new CCounter();\r
\r
this.iSystemSoundType_initial = this.iSystemSoundType.n現在選択されている項目番号; // CONFIGに入ったときの値を保持しておく\r
- // this.iSystemWASAPIBufferSizeMs_initial = this.iSystemWASAPIBufferSizeMs.n現在の値; // CONFIG脱出時にこの値から変更されているようなら\r
+ this.iSystemWASAPIBufferSizeMs_initial = this.iSystemWASAPIBufferSizeMs.n現在の値; // CONFIG脱出時にこの値から変更されているようなら\r
// this.iSystemASIOBufferSizeMs_initial = this.iSystemASIOBufferSizeMs.n現在の値; // サウンドデバイスを再構築する\r
this.iSystemASIODevice_initial = this.iSystemASIODevice.n現在選択されている項目番号; //\r
this.iSystemSoundTimerType_initial = this.iSystemSoundTimerType.GetIndex(); //\r
// #33689 2014.6.17 yyagi CONFIGでSoundTimerTypeの設定を変更した場合も、サウンドデバイスを再構築する。\r
#region [ サウンドデバイス変更 ]\r
if ( this.iSystemSoundType_initial != this.iSystemSoundType.n現在選択されている項目番号 ||\r
- // this.iSystemWASAPIBufferSizeMs_initial != this.iSystemWASAPIBufferSizeMs.n現在の値 ||\r
+ this.iSystemWASAPIBufferSizeMs_initial != this.iSystemWASAPIBufferSizeMs.n現在の値 ||\r
// this.iSystemASIOBufferSizeMs_initial != this.iSystemASIOBufferSizeMs.n現在の値 ||\r
this.iSystemASIODevice_initial != this.iSystemASIODevice.n現在選択されている項目番号 ||\r
this.iSystemSoundTimerType_initial != this.iSystemSoundTimerType.GetIndex() )\r
}\r
\r
CDTXMania.Sound管理.t初期化( soundDeviceType,\r
- 0,\r
- // this.iSystemWASAPIBufferSizeMs.n現在の値,\r
+ // 0,\r
+ this.iSystemWASAPIBufferSizeMs.n現在の値,\r
0,\r
// this.iSystemASIOBufferSizeMs.n現在の値,\r
this.iSystemASIODevice.n現在選択されている項目番号,\r
private CItemToggle iSystemBufferedInput;\r
private CItemInteger iSystemRisky; // #23559 2011.7.27 yyagi\r
private CItemList iSystemSoundType; // #24820 2013.1.3 yyagi\r
-// private CItemInteger iSystemWASAPIBufferSizeMs; // #24820 2013.1.15 yyagi\r
+ private CItemInteger iSystemWASAPIBufferSizeMs; // #24820 2013.1.15 yyagi\r
// private CItemInteger iSystemASIOBufferSizeMs; // #24820 2013.1.3 yyagi\r
private CItemList iSystemASIODevice; // #24820 2013.1.17 yyagi\r
\r
private int iSystemSoundType_initial;\r
-// private int iSystemWASAPIBufferSizeMs_initial;\r
+ private int iSystemWASAPIBufferSizeMs_initial;\r
// private int iSystemASIOBufferSizeMs_initial;\r
private int iSystemASIODevice_initial;\r
private CItemToggle iSystemSoundTimerType; // #33689 2014.6.17 yyagi\r
CDTXMania.ConfigIni.bUseBoxDefSkin = this.iSystemUseBoxDefSkin.bON; // #28195 2012.5.6 yyagi\r
\r
CDTXMania.ConfigIni.nSoundDeviceType = this.iSystemSoundType.n現在選択されている項目番号; // #24820 2013.1.3 yyagi\r
-// CDTXMania.ConfigIni.nWASAPIBufferSizeMs = this.iSystemWASAPIBufferSizeMs.n現在の値; // #24820 2013.1.15 yyagi\r
+ CDTXMania.ConfigIni.nWASAPIBufferSizeMs = this.iSystemWASAPIBufferSizeMs.n現在の値; // #24820 2013.1.15 yyagi\r
// CDTXMania.ConfigIni.nASIOBufferSizeMs = this.iSystemASIOBufferSizeMs.n現在の値; // #24820 2013.1.3 yyagi\r
CDTXMania.ConfigIni.nASIODevice = this.iSystemASIODevice.n現在選択されている項目番号; // #24820 2013.1.17 yyagi\r
CDTXMania.ConfigIni.bUseOSTimer = this.iSystemSoundTimerType.bON; // #33689 2014.6.17 yyagi\r
using System.Collections.Generic;\r
using System.Text;\r
using System.Drawing;\r
+using System.Diagnostics;\r
using SlimDX;\r
using SlimDX.Direct3D9;\r
using FDK;\r
{\r
if ( !base.b活性化してない )\r
{\r
+ try\r
+ {\r
#if TEST_Direct3D9Ex\r
- this.tx描画用 = new CTexture( CDTXMania.app.Device, 320, 355, CDTXMania.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Default, Usage.Dynamic );\r
+ this.tx描画用 = new CTexture( CDTXMania.app.Device, 320, 355, CDTXMania.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Default, Usage.Dynamic );\r
#else\r
- this.tx描画用 = new CTexture( CDTXMania.app.Device, 278, 355, CDTXMania.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Managed );\r
+ this.tx描画用 = new CTexture( CDTXMania.app.Device, 278, 355, CDTXMania.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Managed );\r
#endif\r
+ }\r
+ catch ( CTextureCreateFailedException e )\r
+ {\r
+ Trace.TraceError( "CActAVI: OnManagedリソースの作成(): " + e.Message );\r
+ this.tx描画用 = null;\r
+ }\r
base.OnManagedリソースの作成();\r
}\r
}\r
using System.Text;\r
using System.Runtime.InteropServices;\r
using System.Drawing;\r
+using System.Diagnostics;\r
using SlimDX.Direct3D9;\r
using FDK;\r
\r
{\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
cInvisibleChip.StartSemiInvisible( inst );\r
#region [ Chip Fire effects (auto時用) ]\r
bool bSuccessOPEN = bChipIsO && ( autoR || !pushingR ) && ( autoG || !pushingG ) && ( autoB || !pushingB );\r
- if ( ( bChipHasR && ( autoR || pushingR ) && autoPick ) || ( bSuccessOPEN && autoPick ) )\r
+ if ( autoPick ) // autoPickでない時の処理は、 t入力処理・ギターベース(E楽器パート) で行う\r
{\r
- this.actChipFireGB.Start( 0 + lo, 演奏判定ライン座標 );\r
- }\r
- if ( ( bChipHasG && ( autoG || pushingG ) && autoPick ) || ( bSuccessOPEN && autoPick ) )\r
- {\r
- this.actChipFireGB.Start( 1 + lo, 演奏判定ライン座標 );\r
- }\r
- if ( ( bChipHasB && ( autoB || pushingB ) && autoPick ) || ( bSuccessOPEN && autoPick ) )\r
- {\r
- this.actChipFireGB.Start( 2 + lo, 演奏判定ライン座標 );\r
+ if ( ( bChipHasR && ( autoR || pushingR ) ) || bSuccessOPEN )\r
+ {\r
+ this.actChipFireGB.Start( 0 + lo, 演奏判定ライン座標 );\r
+ }\r
+ if ( ( bChipHasG && ( autoG || pushingG ) ) || bSuccessOPEN )\r
+ {\r
+ this.actChipFireGB.Start( 1 + lo, 演奏判定ライン座標 );\r
+ }\r
+ if ( ( bChipHasB && ( autoB || pushingB ) ) || bSuccessOPEN )\r
+ {\r
+ this.actChipFireGB.Start( 2 + lo, 演奏判定ライン座標 );\r
+ }\r
}\r
#endregion\r
#region [ autopick ]\r
}\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 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
this.bTight = false; // #29500 2012.9.11 kairera0467 TIGHTモード\r
this.nSoundDeviceType = FDK.COS.bIsVistaOrLater ?\r
(int) ESoundDeviceTypeForConfig.WASAPI : (int) ESoundDeviceTypeForConfig.ACM; // #24820 2012.12.23 yyagi 初期値はACM | #31927 2013.8.25 yyagi OSにより初期値変更\r
-// this.nWASAPIBufferSizeMs = 0; // #24820 2013.1.15 yyagi 初期値は0(自動設定)\r
+ this.nWASAPIBufferSizeMs = 0; // #24820 2013.1.15 yyagi 初期値は0(自動設定)\r
this.nASIODevice = 0; // #24820 2013.1.17 yyagi\r
// this.nASIOBufferSizeMs = 0; // #24820 2012.12.25 yyagi 初期値は0(自動設定)\r
this.bUseOSTimer = false;; // #33689 2014.6.6 yyagi 初期値はfalse (FDKのタイマー。FROM氏考案の独自タイマー)\r
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
{\r
this.nSoundDeviceType = C変換.n値を文字列から取得して範囲内に丸めて返す( str4, 0, 2, this.nSoundDeviceType );\r
}\r
- //else if ( str3.Equals( "WASAPIBufferSizeMs" ) )\r
- //{\r
- // this.nWASAPIBufferSizeMs = C変換.n値を文字列から取得して範囲内に丸めて返す( str4, 0, 9999, this.nWASAPIBufferSizeMs );\r
- //}\r
+ else if ( str3.Equals( "WASAPIBufferSizeMs" ) )\r
+ {\r
+ this.nWASAPIBufferSizeMs = C変換.n値を文字列から取得して範囲内に丸めて返す( str4, 0, 9999, this.nWASAPIBufferSizeMs );\r
+ }\r
else if ( str3.Equals( "ASIODevice" ) )\r
{\r
string[] asiodev = CEnumerateAllAsioDevices.GetAllASIODevices();\r
{\r
// プロパティ\r
#region [ properties ]\r
- public static readonly string VERSION = "099c(141020)";\r
+ public static readonly string VERSION = "099c(141224)";\r
public static readonly string SLIMDXDLL = "c_net20x86_Jun2010";\r
public static readonly string D3DXDLL = "d3dx9_43.dll"; // June 2010\r
//public static readonly string D3DXDLL = "d3dx9_42.dll"; // February 2010\r
}\r
Sound管理 = new CSound管理( base.Window.Handle,\r
soundDeviceType,\r
- // CDTXMania.ConfigIni.nWASAPIBufferSizeMs,\r
- 0,\r
+ CDTXMania.ConfigIni.nWASAPIBufferSizeMs,\r
+ // 0,\r
// CDTXMania.ConfigIni.nASIOBufferSizeMs,\r
0,\r
CDTXMania.ConfigIni.nASIODevice,\r
#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
}\r
public void t再生位置を変更する( long n位置ms )\r
{\r
- if( this.bBASSサウンドである )\r
+ if ( this.bBASSサウンドである )\r
{\r
- bool b = BassMix.BASS_Mixer_ChannelSetPosition( this.hBassStream, Bass.BASS_ChannelSeconds2Bytes( this.hBassStream, n位置ms * this.db周波数倍率 * this.db再生速度 / 1000.0 ), BASSMode.BASS_POS_BYTES );\r
- if ( !b )\r
+ bool b = true;\r
+ try\r
+ {\r
+ b = BassMix.BASS_Mixer_ChannelSetPosition( this.hBassStream, Bass.BASS_ChannelSeconds2Bytes( this.hBassStream, n位置ms * this.db周波数倍率 * this.db再生速度 / 1000.0 ), BASSMode.BASS_POS_BYTES );\r
+ }\r
+ catch ( Exception e )\r
+ {\r
+ Trace.TraceInformation( Path.GetFileName( this.strファイル名 ) + ": Seek error: " + e.ToString() );\r
+ }\r
+ finally\r
{\r
- BASSError be = Bass.BASS_ErrorGetCode();\r
- Trace.TraceInformation( Path.GetFileName( this.strファイル名 ) + ": Seek error: " + be.ToString() );\r
+ if ( !b )\r
+ {\r
+ BASSError be = Bass.BASS_ErrorGetCode();\r
+ Trace.TraceInformation( Path.GetFileName( this.strファイル名 ) + ": Seek error: " + be.ToString() );\r
+ }\r
}\r
}\r
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
// Trace.TraceInformation( "Selected Default WASAPI Device: {0}", deviceInfo.name );\r
// Trace.TraceInformation( "MinPeriod={0}, DefaultPeriod={1}", deviceInfo.minperiod, deviceInfo.defperiod );\r
n更新間隔ms = (long) ( deviceInfo.minperiod * 1000 );\r
- n希望バッファサイズms = n更新間隔ms + 1; // 2013.4.25 #31237 yyagi; バッファサイズ設定の完全自動化。更新間隔=バッファサイズにするとBASS_ERROR_UNKNOWNになるので+1する。\r
+ if ( n希望バッファサイズms <= 0 || n希望バッファサイズms < n更新間隔ms + 1 )\r
+ {\r
+ n希望バッファサイズms = n更新間隔ms + 1; // 2013.4.25 #31237 yyagi; バッファサイズ設定の完全自動化。更新間隔=バッファサイズにするとBASS_ERROR_UNKNOWNになるので+1する。\r
+ }\r
}\r
else\r
{\r