我编写了一个程序,该程序可以正常播放声音,但是如何设置3D声音的位置,或者至少可以设置声音在右侧应具有的强度以及声音的强度应该在左边?
到目前为止,这是我的代码:
WaveOut wavOut = new WaveOut();
wavOut.Init(new BlockAlignReductionStream(new WaveFileReader(File.OpenRead("Wav File")));
wavOut.Play();
while(wavOut.PlaybackState == PlaybackState.Playing)
{
Thread.Sleep(250);
}
答案 0 :(得分:0)
假设您有立体声录音,则没有“ 3D”组件。
也许您想改为调整左右声道的响度。如果是这样,您可以尝试使用WaveChannel32类来控制平移-参见此处:https://github.com/naudio/NAudio/blob/e359ca0566e9f9b14fee1ba6e0ec17e4482c7844/NAudio/Wave/WaveStreams/WaveChannel32.cs
将WaveFileReader传递给它,并提供适当的平移值(-1> = x <= 1),然后使用WaveChannel32实例初始化WaveOut。
WaveOut wavOut = new WaveOut();
wavOut.Init(new WaveChannel32(new WaveFileReader(File.OpenRead("WavFile"), 0, 0)); // the last argument in the WaveChannel32 is the pan value
wavOut.Play();