You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using NAudio to create an intercom application. Recently, I've have been getting complaints from users that, when multiple devices are configured, audio stops working. I was able to replicate the situation on my side using 2 USB headsets. In my case, when the snippet below is run, the second device stops working in Windows alltogether. Only when I exit the application, Windows is able to play back sounds on that device. And it's always the second device where Play() is called. Does anyone have a clue as to what could be the root cause here?
` var headset1 = WasapiHelper.GetDeviceById("{0.0.0.00000000}.{e6802322-a556-4327-9be1-0a4bec8ab9fd}", NAudio.CoreAudioApi.DataFlow.Render, NAudio.CoreAudioApi.Role.Console);
var headset2 = WasapiHelper.GetDeviceById("{0.0.0.00000000}.{f33d86c7-7071-44cc-b8e0-d8190341af67}", NAudio.CoreAudioApi.DataFlow.Render, NAudio.CoreAudioApi.Role.Console);
var mixer1 = new TestWaveProvider();
var mixer2 = new TestWaveProvider();
var _waveOut1 = new WasapiOut(headset1, AudioClientShareMode.Shared, false, 50);
_waveOut1.PlaybackStopped += _waveOut1_PlaybackStopped;
_waveOut1.Init(mixer1);
_waveOut1.Play();
var _waveOut2 = new WasapiOut(headset2, AudioClientShareMode.Shared, false, 50);
_waveOut2.PlaybackStopped += _waveOut2_PlaybackStopped;
_waveOut2.Init(mixer2);
_waveOut2.Play();
`
And the TestWaveProvider looks like this:
internal class TestWaveProvider : IWaveProvider
{
public WaveFormat WaveFormat { get; } = new WaveFormat(48000, 32, 2);
public int Read(byte[] buffer, int offset, int count)
{
Debug.WriteLine("Count: " + count.ToString());
return Math.Min(4, buffer.Length - offset);
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi guys,
I'm using NAudio to create an intercom application. Recently, I've have been getting complaints from users that, when multiple devices are configured, audio stops working. I was able to replicate the situation on my side using 2 USB headsets. In my case, when the snippet below is run, the second device stops working in Windows alltogether. Only when I exit the application, Windows is able to play back sounds on that device. And it's always the second device where Play() is called. Does anyone have a clue as to what could be the root cause here?
` var headset1 = WasapiHelper.GetDeviceById("{0.0.0.00000000}.{e6802322-a556-4327-9be1-0a4bec8ab9fd}", NAudio.CoreAudioApi.DataFlow.Render, NAudio.CoreAudioApi.Role.Console);
var headset2 = WasapiHelper.GetDeviceById("{0.0.0.00000000}.{f33d86c7-7071-44cc-b8e0-d8190341af67}", NAudio.CoreAudioApi.DataFlow.Render, NAudio.CoreAudioApi.Role.Console);
`
And the TestWaveProvider looks like this:
Many thanks
Mark
Beta Was this translation helpful? Give feedback.
All reactions