OSDN Git Service

CSCore の高レベルAPIを使って WASAPI 名前空間を再実装。ただし音量が大きいと音割れする。
[strokestylet/CsWin10Desktop3.git] / StrokeStyleT / ステージ / 演奏 / ドラムサウンド.cs
index 18ed76a..afb14ce 100644 (file)
@@ -41,14 +41,14 @@ namespace SST.ステージ.演奏
                                        // 集めた Sounds[] をすべて停止する。
                                        foreach( var sounds in 停止するサウンド群 )
                                                foreach( var sound in sounds )
-                                                       sound.再生を停止する();
+                                                       sound.Stop();
                                }
 
                                // 再生する。
                                if( null != context.Sounds[ context.次に再生するSound番号 ] )
                                {
-                                       context.Sounds[ context.次に再生するSound番号 ].音量 = 音量0to1;
-                                       context.Sounds[ context.次に再生するSound番号 ].再生を開始する();
+                                       context.Sounds[ context.次に再生するSound番号 ].Volume = 音量0to1;
+                                       context.Sounds[ context.次に再生するSound番号 ].Play();
                                }
 
                                // サウンドローテーション。
@@ -62,7 +62,7 @@ namespace SST.ステージ.演奏
                protected readonly string KitXmlファイルパス = @"$(Static)\sounds\Kit.xml";
                protected class Cコンテキスト : IDisposable
                {
-                       public FDK.メディア.サウンド.WASAPIold.Sound[] Sounds = new FDK.メディア.サウンド.WASAPIold.Sound[ ドラムサウンド.多重度 ];
+                       public FDK.メディア.サウンド.WASAPI.Sound[] Sounds = new FDK.メディア.サウンド.WASAPI.Sound[ ドラムサウンド.多重度 ];
                        public int 次に再生するSound番号 = 0;
 
                        public void Dispose()
@@ -71,7 +71,7 @@ namespace SST.ステージ.演奏
                                {
                                        for( int i = 0; i < this.Sounds.Length; i++ )
                                        {
-                                               StrokeStyleT.Wasapiデバイス.サウンドをミキサーから削除する( this.Sounds[ i ] );
+                                               this.Sounds[ i ].Stop();
                                                FDK.Utilities.解放する( ref this.Sounds[ i ] );
                                        }
                                }
@@ -141,16 +141,14 @@ namespace SST.ステージ.演奏
 
                                                                                        // コンテキストを作成する。
                                                                                        var context = new Cコンテキスト() {
-                                                                                               Sounds = new FDK.メディア.サウンド.WASAPIold.Sound[ ドラムサウンド.多重度 ],
+                                                                                               Sounds = new FDK.メディア.サウンド.WASAPI.Sound[ ドラムサウンド.多重度 ],
                                                                                                次に再生するSound番号 = 0,
                                                                                        };
-                                                                                       for( int i = 0; i < context.Sounds.Length; i++ )
-                                                                                       {
-                                                                                               // 多重度分のサウンドを生成しつつ、ミキサーにも登録。
-                                                                                               context.Sounds[ i ] = new FDK.メディア.サウンド.WASAPIold.Sound( サウンドファイルパス );
-                                                                                               StrokeStyleT.Wasapiデバイス.サウンドをミキサーに追加する( context.Sounds[ i ] );
-                                                                                       }
 
+                                                                                       // 多重度分のサウンドを生成する。
+                                                                                       for( int i = 0; i < context.Sounds.Length; i++ )
+                                                                                               context.Sounds[ i ] = StrokeStyleT.サウンドデバイス.CreateSound( サウンドファイルパス );
+                                                                                       
                                                                                        // コンテキストを辞書に追加する。
                                                                                        this.チップtoコンテキスト.Add( チップ種別, context );
                                                                                }