NAudio
NAudio copied to clipboard
Not receiving OnVolumeNotification notifications
var devEnum = new MMDeviceEnumerator();
foreach (var device in devEnum.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active))
{
device.AudioEndpointVolume.OnVolumeNotification += data => {Debug.WriteLine(data.Muted);};
}
OnVolumeNotification doesn't produce a notification when changing the device volume or muted status in my project, even when the device has been enumerated over. Oddly enough, same code seems to work in a new project. Is there something that I have missed and should look out for, perhaps using only a single enumerator, since I have another one elsewhere, or do the notifications reset when enumerating a second time, or something similar?
I had this issue. In my case it was the device object being disposed. Keeping a reference to the object fixed it.
I had this issue. In my case it was the device object being disposed. Keeping a reference to the object fixed it.
Thank you for the reply, been a while since I had to deal with this issue, by now it isn't as relevant so I cannot confirm this in the moment, but I'll definitely check it out eventually!