protected void Dispose(bool bManagedDispose)
        {
            this.e出力デバイス = ESoundDeviceType.Unknown;                    // まず出力停止する(Dispose中にクラス内にアクセスされることを防ぐ)
            if (bManagedDispose)
            {
                #region [ 経緯時間計測用サウンドバッファを解放。]
                //-----------------
                if (this.sd経過時間計測用サウンドバッファ != null)
                {
                    this.sd経過時間計測用サウンドバッファ.tStopSound();
                    CCommon.tDispose(ref this.sd経過時間計測用サウンドバッファ);
                }
                //-----------------
                #endregion
                #region [ 単位繰り上げ用スレッド停止。]
                //-----------------
                if (this.th経過時間測定用スレッド != null)
                {
                    this.th経過時間測定用スレッド.Abort();
                    this.th経過時間測定用スレッド = null;
                }
                //-----------------
                #endregion

                CCommon.tDispose(ref this.DirectSound);
                CCommon.tDispose(this.tmシステムタイマ);
            }
            if (ctimer != null)
            {
                CCommon.tDispose(ref this.ctimer);
            }
        }
Beispiel #2
0
        protected void Dispose(bool bManagedDispose)
        {
            this.eOutputDevice = ESoundDeviceType.Unknown;                      // まず出力停止する(Dispose中にクラス内にアクセスされることを防ぐ)
            if (bManagedDispose)
            {
                #region [ 経緯時間計測用サウンドバッファを解放。]
                //-----------------
                if (this.sd経過時間計測用サウンドバッファ != null)
                {
                    this.sd経過時間計測用サウンドバッファ.tサウンドを停止する();
                    CCommon.tDispose(ref this.sd経過時間計測用サウンドバッファ);
                }
                //-----------------
                #endregion

                CCommon.tDispose(this.tmSystemTimer);
            }
            if (ctimer != null)
            {
                CCommon.tDispose(ref this.ctimer);
            }
            //使わなくなったデータをクリーンアップ
            Alc.MakeContextCurrent(ContextHandle.Zero);
            Alc.DestroyContext(this.context);
            Alc.CloseDevice(this.device);
        }
Beispiel #3
0
        protected void Dispose(bool bManagedDispose)
        {
            this.e出力デバイス = ESoundDeviceType.Unknown;                    // まず出力停止する(Dispose中にクラス内にアクセスされることを防ぐ)
            if (hMixer_DeviceOut != 0)
            {
                BassMix.BASS_Mixer_ChannelPause(this.hMixer_DeviceOut);
                Bass.BASS_StreamFree(this.hMixer_DeviceOut);
                this.hMixer_DeviceOut = 0;
            }
            if (hMixer != 0)
            {
                BassMix.BASS_Mixer_ChannelPause(this.hMixer);
                Bass.BASS_StreamFree(this.hMixer);
                this.hMixer = 0;
            }
            if (!this.bIsBASSFree)
            {
                BassAsio.BASS_ASIO_Free();                  // システムタイマより先に呼び出すこと。(tAsio処理() の中でシステムタイマを参照してるため)
                Bass.BASS_Free();
            }

            if (bManagedDispose)
            {
                CCommon.tDispose(this.tmシステムタイマ);
                this.tmシステムタイマ = null;
            }
        }
Beispiel #4
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);                    // すでに生成済みのサウンドがあれば作り直す。
        }
        protected void Dispose(bool bManagedDispose)
        {
            if (encoder != null)
            {
                encoder.Stop();                  // finish
                encoder.Dispose();
                encoder = null;
            }
            this.e出力デバイス = ESoundDeviceType.Unknown;                    // まず出力停止する(Dispose中にクラス内にアクセスされることを防ぐ)

            if (this.hMixer_DeviceOut != 0)
            {
                BassMix.BASS_Mixer_ChannelPause(this.hMixer_DeviceOut);
                Bass.BASS_StreamFree(this.hMixer_DeviceOut);
                this.hMixer_DeviceOut = 0;
            }
            if (this.hMixer_Record != 0)
            {
                BassMix.BASS_Mixer_ChannelPause(this.hMixer_Record);
                Bass.BASS_StreamFree(this.hMixer_Record);
                this.hMixer_Record = 0;
            }

            if (hMixer != 0)
            {
                BassMix.BASS_Mixer_ChannelPause(this.hMixer_Record);
                Bass.BASS_StreamFree(this.hMixer);
            }
            if (this.hMixer_Chips != null)
            {
                for (int i = 0; i <= (int)CSound.EInstType.Unknown; i++)
                {
                    if (this.hMixer_Chips[i] != 0)
                    {
                        // Mixerにinputされるchannelsがfreeされると、Mixerへのinputも自動でremoveされる。
                        // 従い、ここでは、mixer本体をfreeするだけでよい
                        BassMix.BASS_Mixer_ChannelPause(this.hMixer_Chips[i]);
                        Bass.BASS_StreamFree(this.hMixer_Chips[i]);
                        this.hMixer_Chips[i] = 0;
                    }
                }
            }
#if TEST_MultiThreadedMixer
            //BASSThreadedMixerLibraryWrapper.FreeBASSThreadedMixerLibrary();
#endif

            if (!this.bIsBASSFree)
            {
                BassWasapi.BASS_WASAPI_Free();                  // システムタイマより先に呼び出すこと。(tWasapi処理() の中でシステムタイマを参照してるため)
                Bass.BASS_Free();
            }
            if (bManagedDispose)
            {
                CCommon.tDispose(this.tmシステムタイマ);
                this.tmシステムタイマ = null;
            }
        }
Beispiel #6
0
 protected void Dispose(bool bManagedDispose)
 {
     this.eOutputDevice = ESoundDeviceType.Unknown;                      // まず出力停止する(Dispose中にクラス内にアクセスされることを防ぐ)
     if (hMixer != -1)
     {
         Bass.BASS_StreamFree(this.hMixer);
     }
     if (!this.bIsBASSSoundFree)
     {
         BassWasapi.BASS_WASAPI_Free();                  // システムタイマより先に呼び出すこと。(tWasapi処理() の中でシステムタイマを参照してるため)
         Bass.BASS_Free();
     }
     if (bManagedDispose)
     {
         CCommon.tDispose(this.tmSystemTimer);
         this.tmSystemTimer = null;
     }
 }
Beispiel #7
0
 public static void t終了()
 {
     CCommon.tDispose(SoundDevice); SoundDevice = null;
     CCommon.tDispose(ref rc演奏用タイマ);               // Global.Bass を解放した後に解放すること。(Global.Bass で参照されているため)
 }
Beispiel #8
0
 //-----------------
 public void Dispose()
 {
     CCommon.tDispose(ref this.timer);
 }