See also the linked bug report, but the short description is that some wine-only fake device was removed at some point, and winecfg's audio tab was never updated to handle that situation. This MR fixes that problem by using real devices and filling in some data structures to make that work.
I'm marking this as a draft so that others can suggest improvements or alternatives, as I'm not sure if this means of doing it is acceptable to Wine.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58204
-- v5: winecfg: Fix audio tab by fetching the default device's audio driver. mmdevapi: Set DEVPKEY_Device_Driver during MMDevice_Create().
From: Patrick Hibbs hibbsncc1701@gmail.com
So that winecfg can fetch the used audio driver. --- dlls/mmdevapi/devenum.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c index adce05da954..d147d246636 100644 --- a/dlls/mmdevapi/devenum.c +++ b/dlls/mmdevapi/devenum.c @@ -543,6 +543,11 @@ static MMDevice *MMDevice_Create(const WCHAR *name, GUID *id, EDataFlow flow, DW PropVariantClear(&pv2); }
+ pv.vt = VT_LPWSTR; + pv.pwszVal = drvs.module_name; + + MMDevice_SetPropValue(id, flow, (const PROPERTYKEY*)&DEVPKEY_Device_Driver, &pv); + RegCloseKey(keyprop); } RegCloseKey(key);
From: Patrick Hibbs hibbsncc1701@gmail.com
V2: Don't give errors about non-existent wine devices. Remove unnecessary patch.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58204 --- programs/winecfg/audio.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/programs/winecfg/audio.c b/programs/winecfg/audio.c index b98efbc2ec6..b0fa6e8f390 100644 --- a/programs/winecfg/audio.c +++ b/programs/winecfg/audio.c @@ -184,12 +184,15 @@ static BOOL get_driver_name(IMMDeviceEnumerator *devenum, PROPVARIANT *pv) IPropertyStore *ps; HRESULT hr;
- hr = IMMDeviceEnumerator_GetDevice(devenum, L"Wine info device", &device); - if(FAILED(hr)) + hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum, eRender, eConsole, &device); + if(FAILED(hr)) { + ERR("Could not get default audio endpoint.\n"); return FALSE; + }
hr = IMMDevice_OpenPropertyStore(device, STGM_READ, &ps); if(FAILED(hr)){ + ERR("Could not get property store for default audio endpoint (0x%p).\n", device); IMMDevice_Release(device); return FALSE; } @@ -198,8 +201,10 @@ static BOOL get_driver_name(IMMDeviceEnumerator *devenum, PROPVARIANT *pv) (const PROPERTYKEY *)&DEVPKEY_Device_Driver, pv); IPropertyStore_Release(ps); IMMDevice_Release(device); - if(FAILED(hr)) + if(FAILED(hr) || pv == NULL || pv->pwszVal == NULL) { + ERR("Could not get device driver property value.\n"); return FALSE; + }
return TRUE; }