NAudio AudioSessionManager.RefreshSessions throws not implemented

  Kiến thức lập trình

In some clients’ machines this code

var appsList = new Dictionary<string, ActiveAudioDevice>();
MMDeviceEnumerator enumerator = new MMDeviceEnumerator();

foreach (MMDevice device in enumerator.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active))
{
    for (int i = device.AudioSessionManager.Sessions.Count - 1; i >= 0; i--) // <--- Exception here
    {
        var session = device.AudioSessionManager.Sessions[i];
        // DO SOME STUFF WITH SESSION
    }
}

return new List<ActiveAudioDevice>(appsList.Values);

throws the next exception

Not implemented

with stack trace

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at NAudio.CoreAudioApi.AudioSessionManager.RefreshSessions()
   at NAudio.CoreAudioApi.AudioSessionManager..ctor(IAudioSessionManager audioSessionManager)
   at NAudio.CoreAudioApi.MMDevice.GetAudioSessionManager()
   at MyClass.GetActiveAudioApps()

What does it mean this error and why it happens only on few specific computers (~2 of 1000)? Are there some parameters that I should check?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT