Play sound on specific channel with NAudio

好久不见. 提交于 2019-12-08 08:16:24

问题


I'm using NAudio for sound work. And i have specific task. I have 8 channel sound card. How can I play sound in only 1, 2 or more specific channels. For example I have this code:

                Device = new WaveOut();
                var provider = new SineWaveProvider32();
                provider.SetWaveFormat(44100, 1);
                provider.Frequency = 1000f;
                provider.Amplitude = 1f;
                Device.DeviceNumber = number;
                Device.Init(provider);
                Device.Play();

This code play sound on all channels. What i need to change in this?


回答1:


You could use a MultiplexingWaveProvider and pass in a silence producing wave provider for one channel and a SineWaveProvider32 for the other.

Also note that your soundcard may not necessarily support multi-channel audio through the WaveOut API.



来源:https://stackoverflow.com/questions/22248138/play-sound-on-specific-channel-with-naudio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!