OSDN Git Service

#37271 BASSmixでのミキシング並列処理の対応に伴い、BASSThreadedeMixerLibrary関連コードを削除。(ただし、もともと#if.....
authoryyagi <yyagi.dtxmania@gmail.com>
Mon, 27 Sep 2021 02:22:18 +0000 (11:22 +0900)
committeryyagi <yyagi.dtxmania@gmail.com>
Mon, 27 Sep 2021 02:22:18 +0000 (11:22 +0900)
DTXMania/コード/全体/Program.cs
FDK/コード/03.サウンド/CSound.cs
FDK/コード/03.サウンド/CSoundDeviceWASAPI.cs
RuntimeResources/dll/x64/BASSThreadedMixer.dll [deleted file]

index 2395593..9927f1f 100644 (file)
@@ -171,11 +171,6 @@ namespace DTXMania
                                        "bass_fx.dll is not loaded. bass_fx.dll or bass.dll must not exist." + newLine + "Please download DTXMania again."
                                        ))
                                        bDLLnotfound = true;
-                               //if (!tDLLの存在チェック("dll\\BASSThreadedMixer.dll",
-                               //      "BASSThreadedMixer.dll を読み込めません。BASSThreadedMixer.dll が存在しません。" + newLine + "DTXManiaをダウンロードしなおしてください。",
-                               //      "BASSThreadedMixer.dll is not loaded. BASSThreadedMixer.dll must not exist." + newLine + "Please download DTXMania again."
-                               //      ))
-                               //      bDLLnotfound = true;
                                if (!tDLLの存在チェック("dll\\DirectShowLib.dll",
                                        "DirectShowLib.dll が存在しません。" + newLine + "DTXManiaをダウンロードしなおしてください。",
                                        "DirectShowLib.dll is not found." + newLine + "Please download DTXMania again."
index 1f4b717..6a0a825 100644 (file)
@@ -1928,12 +1928,7 @@ Debug.WriteLine("更に再生に失敗: " + Path.GetFileName(this.strファイ
                }
                public bool tBASSサウンドをミキサーから削除する( int channel )
                {
-#if TEST_MultiThreadedMixer
-                       bool b = BASSThreadedMixerLibraryWrapper.BASS_ThreadedMixer_RemoveSource((IntPtr)this.hMixer, channel );
-                       mixingChannel.Remove((IntPtr)this.hMixer);
-#else
                        bool b = BassMix.BASS_Mixer_ChannelRemove(channel);
-#endif
                        if ( b )
                        {
                                Interlocked.Decrement( ref CSound管理.nMixing );
@@ -1945,17 +1940,10 @@ Debug.WriteLine("更に再生に失敗: " + Path.GetFileName(this.strファイ
 
 
                // mixer への追加
-#if TEST_MultiThreadedMixer
-               private List<IntPtr> mixingChannel = new List<IntPtr>();
-#endif
 
                public bool tBASSサウンドをミキサーに追加する()
                {
-#if TEST_MultiThreadedMixer
-                       if (!mixingChannel.Contains((IntPtr)this.hMixer))
-#else
                        if ( BassMix.BASS_Mixer_ChannelGetMixer( hBassStream ) == 0 )
-#endif
                        {
                                // #41145 removed BassFlag.BASS_SPEAKER_FRONT for mono speaker.
                                // BASS_Mixer_StreamAddChannel() returns error if stereo (or higher) channels are input but speaker is mono.
@@ -1965,17 +1953,12 @@ Debug.WriteLine("更に再生に失敗: " + Path.GetFileName(this.strファイ
                                // preloadされることを期待して、敢えてflagからはBASS_MIXER_PAUSEを外してAddChannelした上で、すぐにPAUSEする
                                // -> ChannelUpdateでprebufferできることが分かったため、BASS_MIXER_PAUSEを使用することにした
 
-#if TEST_MultiThreadedMixer
-                               bool b1 = BASSThreadedMixerLibraryWrapper.BASS_ThreadedMixer_AddSource( (IntPtr)this.hMixer, this.hBassStream, IntPtr.Zero );
-                               mixingChannel.Add((IntPtr)this.hMixer);
-#else
                                bool b1 = BassMix.BASS_Mixer_StreamAddChannel(this.hMixer, this.hBassStream, bf);
                                if (!b1)
                                {
                                        BASSError errcode = Bass.BASS_ErrorGetCode();
                                        Trace.TraceWarning($"{Path.GetFileName(this.strファイル名)}: BASS_Mixer_StreamAddChannel()@tBASSサウンドをミキサーに追加する() failed. {errcode}");
                                }
-#endif
                                //bool b2 = BassMix.BASS_Mixer_ChannelPause( this.hBassStream );
                                t再生位置を先頭に戻す();      // StreamAddChannelの後で再生位置を戻さないとダメ。逆だと再生位置が変わらない。
 //Trace.TraceInformation( "Add Mixer: " + Path.GetFileName( this.strファイル名 ) + " (" + hBassStream + ")" + " MixedStreams=" + CSound管理.nMixing );
index 0f3d4f6..1e539f2 100644 (file)
@@ -471,11 +471,6 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s,
                                //-----------------
                                #endregion
                        }
-#if TEST_MultiThreadedMixer
-                       //LoadLibraryに失敗する・・・
-                       //BASSThreadedMixerLibraryWrapper.InitBASSThreadedMixerLibrary();
-#endif
-
 
                        // WASAPI出力と同じフォーマットを持つ BASS ミキサーを作成。
                        // 1つのまとめとなるmixer (hMixer) と、そこにつなぐ複数の楽器別mixer (hMixer _forChips)を作成。
@@ -484,19 +479,11 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s,
                        //      string.Format( "BASS_SetConfig(CONFIG_MIXER_BUFFER) に失敗しました。[{0}", Bass.BASS_ErrorGetCode() ) );
 
                        var info = BassWasapi.BASS_WASAPI_GetInfo();
-#if TEST_MultiThreadedMixer
-                       this.hMixer = BASSThreadedMixerLibraryWrapper.BASS_ThreadedMixer_Create(
-                               info.freq,
-                               info.chans,
-                               (int)(BASSFlag.BASS_MIXER_NONSTOP | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_POSEX),
-                               out hMixerThreaded
-                       );
-#else
+
                        this.hMixer = BassMix.BASS_Mixer_StreamCreate(
                                info.freq,
                                info.chans,
                                BASSFlag.BASS_MIXER_NONSTOP | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_POSEX);    // デコードのみ=発声しない。WASAPIに出力されるだけ。
-#endif
                        if (this.hMixer == 0 )
                        {
                                BASSError errcode = Bass.BASS_ErrorGetCode();
@@ -509,19 +496,10 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s,
 
                        for (int i = 0; i <= (int)CSound.EInstType.Unknown; i++)
                        {
-#if TEST_MultiThreadedMixer
-                               this.hMixer_Chips[i] = BASSThreadedMixerLibraryWrapper.BASS_ThreadedMixer_Create(
-                                       info.freq,
-                                       info.chans,
-                                       (int)(BASSFlag.BASS_MIXER_NONSTOP | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_POSEX),
-                                       out this.hMixerThreaded_Chips[i]
-                               );    // デコードのみ=発声しない。WASAPIに出力されるだけ。
-#else
                                this.hMixer_Chips[ i ] = BassMix.BASS_Mixer_StreamCreate(
                                        info.freq,
                                        info.chans,
                                        BASSFlag.BASS_MIXER_NONSTOP | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_POSEX);    // デコードのみ=発声しない。WASAPIに出力されるだけ。
-#endif
                                if (this.hMixer_Chips[ i ] == 0)
                                {
                                        BASSError errcode = Bass.BASS_ErrorGetCode();
@@ -535,11 +513,7 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s,
                                Bass.BASS_ChannelSetAttribute(this.hMixer_Chips[i], BASSAttribute.BASS_ATTRIB_VOL, CSound管理.nMixerVolume[i] / 100.0f);
                                //Trace.TraceInformation("Vol{0}: {1}", i, CSound管理.nMixerVolume[i]);
 
-#if TEST_MultiThreadedMixer
-                               bool b1 = BASSThreadedMixerLibraryWrapper.BASS_ThreadedMixer_AddSource(this.hMixerThreaded, this.hMixer_Chips[i], IntPtr.Zero);
-#else
                                bool b1 = BassMix.BASS_Mixer_StreamAddChannel(this.hMixer, this.hMixer_Chips[i], BASSFlag.BASS_DEFAULT);
-#endif
                                if (!b1)
                                {
                                        BASSError errcode = Bass.BASS_ErrorGetCode();
@@ -701,11 +675,7 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s,
                public CSound tサウンドを作成する( string strファイル名, CSound.EInstType eInstType )
                {
                        var sound = new CSound();
-#if TEST_MultiThreadedMixer
-                       int hmixer = (int)hMixerThreaded_Chips[ (int)eInstType ];
-#else
                        int hmixer = hMixer_Chips[(int)eInstType];
-#endif
                        sound.tWASAPIサウンドを作成する( strファイル名, hmixer, this.e出力デバイス, eInstType );
                        return sound;
                }
@@ -716,30 +686,18 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s,
                public CSound tサウンドを作成する( byte[] byArrWAVファイルイメージ, CSound.EInstType eInstType )
                {
                        var sound = new CSound();
-#if TEST_MultiThreadedMixer
-                       int hmixer = (int)hMixerThreaded_Chips[(int)eInstType];
-#else
                        int hmixer = hMixer_Chips[(int)eInstType];
-#endif
                        sound.tWASAPIサウンドを作成する( byArrWAVファイルイメージ, hmixer, this.e出力デバイス, eInstType );
                        return sound;
                }
                public void tサウンドを作成する( string strファイル名, ref CSound sound, CSound.EInstType eInstType )
                {
-#if TEST_MultiThreadedMixer
-                       int hmixer = (int)hMixerThreaded_Chips[(int)eInstType];
-#else
                        int hmixer = hMixer_Chips[(int)eInstType];
-#endif
                        sound.tWASAPIサウンドを作成する( strファイル名, hmixer, this.e出力デバイス, eInstType );
                }
                public void tサウンドを作成する( byte[] byArrWAVファイルイメージ, ref CSound sound, CSound.EInstType eInstType)
                {
-#if TEST_MultiThreadedMixer
-                       int hmixer = (int)hMixerThreaded_Chips[(int)eInstType];
-#else
                        int hmixer = hMixer_Chips[(int)eInstType];
-#endif
                        sound.tWASAPIサウンドを作成する( byArrWAVファイルイメージ, hmixer, this.e出力デバイス, eInstType );
                }
 #endregion
@@ -793,9 +751,6 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s,
                                        }
                                }
                        }
-#if TEST_MultiThreadedMixer
-                       //BASSThreadedMixerLibraryWrapper.FreeBASSThreadedMixerLibrary();               
-#endif
 
                        if ( !this.bIsBASSFree )
                        {
@@ -820,10 +775,6 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s,
                protected int hMixer_Record = 0;
                protected int[] hMixer_Chips = new int[(int)CSound.EInstType.Unknown + 1];  //DTX2WAV対応 BGM, SE, Drums...を別々のmixerに入れて、個別に音量変更できるようにする
 
-#if TEST_MultiThreadedMixer
-               protected IntPtr hMixerThreaded = IntPtr.Zero;
-               protected IntPtr[] hMixerThreaded_Chips = new IntPtr[(int)CSound.EInstType.Unknown + 1];
-#endif
                protected BaseEncoder encoder;
                protected int stream;
                protected WASAPIPROC tWasapiProc = null;
diff --git a/RuntimeResources/dll/x64/BASSThreadedMixer.dll b/RuntimeResources/dll/x64/BASSThreadedMixer.dll
deleted file mode 100644 (file)
index de2ffbe..0000000
Binary files a/RuntimeResources/dll/x64/BASSThreadedMixer.dll and /dev/null differ