So, I did a Google search on disabling audio ducking on windows for an application, and this is what I found on a Microsoft site.
It is C++ code. I do not know C++ very well, so I do not understand exactly what this is doing, and I m not sure if this helps me at all, but perhaps someone can understand this and see if this can help with this problem.
I tried to compile it, but I am missing something because it is making a reference to a type
HRESULT
that I am guessing is not in the standard c++ library.
HRESULT DuckingOptOut(bool DuckingOptOutChecked)
{
HRESULT hr = S_OK;
IMMDeviceEnumerator* pDeviceEnumerator NULL;
IMMDevice* pEndpoint = NULL;
IAudioSessionManager2* pSessionManager2 = NULL;
IAudioSessionControl* pSessionControl = NULL;
IAudioSessionControl2* pSessionControl2 = NULL;
// Start with the default endpoint.
hr = CoCreateInstance(__uuidof(MMDeviceEnumerator),
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&pDeviceEnumerator));
if (SUCCEEDED(hr))
{
hr = pDeviceEnumerator>GetDefaultAudioEndpoint(eRender, eConsole, &pEndpoint);
pDeviceEnumerator>Release();
pDeviceEnumerator = NULL;
}
// Activate session manager.
if (SUCCEEDED(hr))
{
hr = pEndpoint->Activate(__uuidof(IAudioSessionManager2),
CLSCTX_INPROC_SERVER,
NULL,
reinterpret_cast<void **>(&pSessionManager2));
pEndpoint->Release();
pEndpoint = NULL;
}
if (SUCCEEDED(hr))
{
hr = pSessionManager2->GetAudioSessionControl(NULL, 0, &pSessionControl);
pSessionManager2->Release();
pSessionManager2 = NULL;
}
if (SUCCEEDED(hr))
{
hr = pSessionControl->QueryInterface(
__uuidof(IAudioSessionControl2),
(void**)&pSessionControl2);
pSessionControl->Release();
pSessionControl = NULL;
}
// Sync the ducking state with the specified preference.
if (SUCCEEDED(hr))
{
if (DuckingOptOutChecked)
{
hr = pSessionControl2->SetDuckingPreference(TRUE);
}
else
{
hr = pSessionControl2->SetDuckingPreference(FALSE);
}
pSessionControl2->Release();
pSessionControl2 = NULL;
}
return hr;
}
Not sure if this helps at all. Hopefully someone has some idea.
TJ Breitenfeldt