public void tInitialize(ESoundDeviceType soundDeviceType, int _nSoundDelayExclusiveWASAPI, int _nSoundDelayASIO, int _nASIODevice, int _nSoundDelayBASS, bool _bUseOSTimer) { //SoundDevice = null; // 後で再初期化することがあるので、null初期化はコンストラクタに回す rc演奏用タイマ = null; // Global.Bass 依存(つまりユーザ依存) nMixing = 0; SoundDelayExclusiveWASAPI = _nSoundDelayExclusiveWASAPI; SoundDelayASIO = _nSoundDelayASIO; SoundDelayBASS = _nSoundDelayBASS; ASIODevice = _nASIODevice; bUseOSTimer = _bUseOSTimer; ESoundDeviceType[] ESoundDeviceTypes = new ESoundDeviceType[6] { ESoundDeviceType.SharedWASAPI, ESoundDeviceType.ExclusiveWASAPI, ESoundDeviceType.ASIO, ESoundDeviceType.BASS, ESoundDeviceType.OpenAL, ESoundDeviceType.Unknown }; int n初期デバイス; switch (soundDeviceType) { case ESoundDeviceType.SharedWASAPI: n初期デバイス = 0; break; case ESoundDeviceType.ExclusiveWASAPI: n初期デバイス = 1; break; case ESoundDeviceType.ASIO: n初期デバイス = 2; break; case ESoundDeviceType.BASS: n初期デバイス = 3; break; case ESoundDeviceType.OpenAL: n初期デバイス = 4; break; default: n初期デバイス = 5; break; } for (SoundDeviceType = ESoundDeviceTypes[n初期デバイス]; ; SoundDeviceType = ESoundDeviceTypes[++n初期デバイス]) { try { t現在のユーザConfigに従ってサウンドデバイスとすべての既存サウンドを再構築する(); break; } catch (Exception e) { Trace.TraceError(e.ToString()); Trace.TraceError("An exception has occurred, but processing continues."); if (ESoundDeviceTypes[n初期デバイス] == ESoundDeviceType.Unknown) { Trace.TraceError(string.Format("サウンドデバイスの初期化に失敗しました。")); break; } } } }
/// <summary> /// DTXMania用コンストラクタ /// </summary> /// <param name="handle"></param> /// <param name="soundDeviceType"></param> /// <param name="nSoundDelayExclusiveWASAPI"></param> /// <param name="nSoundDelayASIO"></param> /// <param name="nASIODevice"></param> public CSoundManager(ESoundDeviceType soundDeviceType, int nSoundDelayExclusiveWASAPI, int nSoundDelayASIO, int nASIODevice, int nSoundDelayBASS, bool _bUseOSTimer) { SoundDevice = null; //bUseOSTimer = false; tInitialize(soundDeviceType, nSoundDelayExclusiveWASAPI, nSoundDelayASIO, nASIODevice, nSoundDelayBASS, _bUseOSTimer); }