Commit 73654470 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

Revert "dsound: Get rid of the global device GUID arrays.".

parent ed7aca01
......@@ -73,6 +73,9 @@ static CRITICAL_SECTION_DEBUG DSOUND_renderers_lock_debug =
};
CRITICAL_SECTION DSOUND_renderers_lock = { &DSOUND_renderers_lock_debug, -1, 0, 0, 0, 0 };
GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
const WCHAR wine_vxd_drv[] = L"winemm.vxd";
/* All default settings, you most likely don't want to touch these, see wiki on UsefulRegistryKeys */
......@@ -385,13 +388,13 @@ HRESULT get_mmdevice(EDataFlow flow, const GUID *tgt, IMMDevice **device)
return DSERR_INVALIDPARAM;
}
static BOOL send_device(IMMDevice *device, LPDSENUMCALLBACKW cb, void *user)
static BOOL send_device(IMMDevice *device, GUID *guid,
LPDSENUMCALLBACKW cb, void *user)
{
IPropertyStore *ps;
PROPVARIANT pv;
BOOL keep_going;
HRESULT hr;
GUID guid;
PropVariantInit(&pv);
......@@ -401,7 +404,7 @@ static BOOL send_device(IMMDevice *device, LPDSENUMCALLBACKW cb, void *user)
return TRUE;
}
hr = get_mmdevice_guid(device, ps, &guid);
hr = get_mmdevice_guid(device, ps, guid);
if(FAILED(hr)){
IPropertyStore_Release(ps);
return TRUE;
......@@ -415,10 +418,10 @@ static BOOL send_device(IMMDevice *device, LPDSENUMCALLBACKW cb, void *user)
return TRUE;
}
TRACE("Calling back with %s (%s)\n", wine_dbgstr_guid(&guid),
TRACE("Calling back with %s (%s)\n", wine_dbgstr_guid(guid),
wine_dbgstr_w(pv.pwszVal));
keep_going = cb(&guid, pv.pwszVal, wine_vxd_drv, user);
keep_going = cb(guid, pv.pwszVal, wine_vxd_drv, user);
PropVariantClear(&pv);
IPropertyStore_Release(ps);
......@@ -428,12 +431,13 @@ static BOOL send_device(IMMDevice *device, LPDSENUMCALLBACKW cb, void *user)
/* S_FALSE means the callback returned FALSE at some point
* S_OK means the callback always returned TRUE */
HRESULT enumerate_mmdevices(EDataFlow flow, LPDSENUMCALLBACKW cb, void *user)
HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids,
LPDSENUMCALLBACKW cb, void *user)
{
IMMDeviceEnumerator *devenum;
IMMDeviceCollection *coll;
IMMDevice *defdev = NULL;
UINT count, i;
UINT count, i, n;
BOOL keep_going;
HRESULT hr, init_hr;
......@@ -472,8 +476,10 @@ HRESULT enumerate_mmdevices(EDataFlow flow, LPDSENUMCALLBACKW cb, void *user)
eMultimedia, &defdev);
if(FAILED(hr)){
defdev = NULL;
n = 0;
}else{
keep_going = send_device(defdev, cb, user);
keep_going = send_device(defdev, &guids[0], cb, user);
n = 1;
}
}
......@@ -487,7 +493,8 @@ HRESULT enumerate_mmdevices(EDataFlow flow, LPDSENUMCALLBACKW cb, void *user)
}
if(device != defdev){
keep_going = send_device(device, cb, user);
keep_going = send_device(device, &guids[n], cb, user);
++n;
}
IMMDevice_Release(device);
......@@ -530,7 +537,8 @@ HRESULT WINAPI DirectSoundEnumerateW(
setup_dsound_options();
hr = enumerate_mmdevices(eRender, lpDSEnumCallback, lpContext);
hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids,
lpDSEnumCallback, lpContext);
return SUCCEEDED(hr) ? DS_OK : hr;
}
......@@ -593,7 +601,8 @@ DirectSoundCaptureEnumerateW(
setup_dsound_options();
hr = enumerate_mmdevices(eCapture, lpDSEnumCallback, lpContext);
hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids,
lpDSEnumCallback, lpContext);
return SUCCEEDED(hr) ? DS_OK : hr;
}
......
......@@ -255,6 +255,9 @@ HRESULT IDirectSoundCaptureImpl_Create(IUnknown *outer_unk, REFIID riid, void **
extern CRITICAL_SECTION DSOUND_renderers_lock;
extern struct list DSOUND_renderers;
extern GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
extern GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
extern const WCHAR wine_vxd_drv[];
void setup_dsound_options(void);
......@@ -263,4 +266,5 @@ HRESULT get_mmdevice(EDataFlow flow, const GUID *tgt, IMMDevice **device);
BOOL DSOUND_check_supported(IAudioClient *client, DWORD rate,
DWORD depth, WORD channels);
HRESULT enumerate_mmdevices(EDataFlow flow, LPDSENUMCALLBACKW cb, void *user);
HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids,
LPDSENUMCALLBACKW cb, void *user);
......@@ -134,9 +134,11 @@ static HRESULT DSPROPERTY_WaveDeviceMappingW(
search.found_guid = &ppd->DeviceId;
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER)
hr = enumerate_mmdevices(eRender, search_callback, &search);
hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids,
search_callback, &search);
else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE)
hr = enumerate_mmdevices(eCapture, search_callback, &search);
hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids,
search_callback, &search);
else
return DSERR_INVALIDPARAM;
......@@ -314,10 +316,12 @@ static HRESULT DSPROPERTY_EnumerateW(
return E_PROP_ID_UNSUPPORTED;
}
hr = enumerate_mmdevices(eRender, enum_callback, ppd);
hr = enumerate_mmdevices(eRender, DSOUND_renderer_guids,
enum_callback, ppd);
if(hr == S_OK)
hr = enumerate_mmdevices(eCapture, enum_callback, ppd);
hr = enumerate_mmdevices(eCapture, DSOUND_capture_guids,
enum_callback, ppd);
return SUCCEEDED(hr) ? DS_OK : hr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment