Esempio n. 1
0
        public static void t現在のユーザConfigに従ってサウンドデバイスとすべての既存サウンドを再構築する()
        {
            #region [ すでにサウンドデバイスと演奏タイマが構築されていれば解放する。]
            //-----------------
            if (SoundDevice != null)
            {
                // すでに生成済みのサウンドがあれば初期状態に戻す。

                CSound.tすべてのサウンドを初期状態に戻す();                     // リソースは解放するが、CSoundのインスタンスは残す。


                // サウンドデバイスと演奏タイマを解放する。

                CCommon.tDispose(SoundDevice); SoundDevice = null;
                CCommon.tDispose(ref rc演奏用タイマ);                   // Global.SoundDevice を解放した後に解放すること。(Global.SoundDevice で参照されているため)
            }
            //-----------------
            #endregion

            #region [ 新しいサウンドデバイスを構築する。]
            //-----------------
            switch (SoundDeviceType)
            {
            case ESoundDeviceType.ExclusiveWASAPI:
                SoundDevice = new CSoundDeviceWASAPI(CSoundDeviceWASAPI.Eデバイスモード.Exclusive, SoundDelayExclusiveWASAPI, SoundUpdatePeriodExclusiveWASAPI);
                break;

            case ESoundDeviceType.SharedWASAPI:
                SoundDevice = new CSoundDeviceWASAPI(CSoundDeviceWASAPI.Eデバイスモード.Shared, SoundDelaySharedWASAPI, SoundUpdatePeriodSharedWASAPI);
                break;

            case ESoundDeviceType.ASIO:
                SoundDevice = new CSoundDeviceASIO(SoundDelayASIO, ASIODevice);
                break;

            case ESoundDeviceType.BASS:
                SoundDevice = new CSoundDeviceBASS(SoundUpdatePeriodBASS, SoundDelayBASS);
                break;

            case ESoundDeviceType.OpenAL:
                SoundDevice = new CSoundDeviceOpenAL(SoundDelayOpenAL, bUseOSTimer);
                break;

            default:
                throw new Exception(string.Format("未対応の SoundDeviceType です。[{0}]", SoundDeviceType.ToString()));
            }
            //-----------------
            #endregion
            #region [ 新しい演奏タイマを構築する。]
            //-----------------
            rc演奏用タイマ = new CSoundTimer(SoundDevice);
            //-----------------
            #endregion

            SoundDevice.nMasterVolume = _nMasterVolume;             // サウンドデバイスに対して、マスターボリュームを再設定する

            CSound.tすべてのサウンドを再構築する(SoundDevice);                    // すでに生成済みのサウンドがあれば作り直す。
        }