Unable to set SetDuckingPreference
ReferenceType opened this issue · comments
Hi
Im trying to do Stream Attenuation(Ducking), same as what skype does during call.
I am unable to set SetDuckingPreference on MMDevice, it doesnt change anything.
platform : Windows 11
What i did is :
defDevice.AudioSessionManager.OnSessionCreated += AudioSessionManagerOnSessionCreated;
private void AudioSessionManagerOnSessionCreated(object sender, IAudioSessionControl newSession)
{
cc = newSession as IAudioSessionControl2;
int hres = cc.SetDuckingPreference(true);
}
where this device is used on WasapiOut.
Where i checked windows API for IAudioSessionControl2::SetDuckingPreference method (audiopolicy.h)
I dont know if you already implemented this or am i missing a hidden feature where i can activate Ducking.
Any help is appreciated.
Thanks
Ok so upon some trial and error it seems you cant enumerate device and select even if its same device.
it only works on default with communication role
var outputDevice = new MMDeviceEnumerator().GetDefaultAudioEndpoint(DataFlow.Render, Role.Communications);
if you enumerate for same device, it wont duck.
foreach (MMDevice wasapi in enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active))
...
So i cant provide options for user.
If you know a workaround please let me know.