Commit 7c61a616 authored by Johan Gill's avatar Johan Gill Committed by Alexandre Julliard

Only enumerate DirectSound devices if the first sound device in the

system supports the Wine implementation of DirectSound. Also added some entries to the sample config file and changed the values of the "EmulDriver" key to "Y"/"N".
parent cc208a15
...@@ -289,6 +289,22 @@ static int ds_snd_queue_max = DS_SND_QUEUE_MAX; ...@@ -289,6 +289,22 @@ static int ds_snd_queue_max = DS_SND_QUEUE_MAX;
static int ds_snd_queue_min = DS_SND_QUEUE_MIN; static int ds_snd_queue_min = DS_SND_QUEUE_MIN;
/* /*
* Call the callback provided to DirectSoundEnumerateA.
*/
inline static void enumerate_devices(LPDSENUMCALLBACKA lpDSEnumCallback,
LPVOID lpContext)
{
if (lpDSEnumCallback != NULL)
if (lpDSEnumCallback(NULL, "Primary DirectSound Driver",
"sound", lpContext))
lpDSEnumCallback((LPGUID)&DSDEVID_WinePlayback,
"WINE DirectSound", "sound",
lpContext);
}
/*
* Get a config key from either the app-specific or the default config * Get a config key from either the app-specific or the default config
*/ */
...@@ -341,7 +357,7 @@ inline static void setup_dsound_options(void) ...@@ -341,7 +357,7 @@ inline static void setup_dsound_options(void)
/* get options */ /* get options */
if (!get_config_key( hkey, appkey, "EmulDriver", buffer, MAX_PATH )) if (!get_config_key( hkey, appkey, "EmulDriver", buffer, MAX_PATH ))
ds_emuldriver = atoi(buffer); ds_emuldriver = strcmp(buffer, "N");
if (!get_config_key( hkey, appkey, "HELmargin", buffer, MAX_PATH )) if (!get_config_key( hkey, appkey, "HELmargin", buffer, MAX_PATH ))
ds_hel_margin = atoi(buffer); ds_hel_margin = atoi(buffer);
...@@ -387,18 +403,21 @@ HRESULT WINAPI DirectSoundEnumerateA( ...@@ -387,18 +403,21 @@ HRESULT WINAPI DirectSoundEnumerateA(
LPDSENUMCALLBACKA lpDSEnumCallback, LPDSENUMCALLBACKA lpDSEnumCallback,
LPVOID lpContext) LPVOID lpContext)
{ {
WAVEOUTCAPSA wcaps;
unsigned devs, wod;
TRACE("lpDSEnumCallback = %p, lpContext = %p\n", TRACE("lpDSEnumCallback = %p, lpContext = %p\n",
lpDSEnumCallback, lpContext); lpDSEnumCallback, lpContext);
#ifdef HAVE_OSS devs = waveOutGetNumDevs();
if (lpDSEnumCallback != NULL) for (wod = 0; wod < devs; ++wod) {
if (lpDSEnumCallback(NULL, "Primary DirectSound Driver", waveOutGetDevCapsA(wod, &wcaps, sizeof(wcaps));
"sound", lpContext)) if (wcaps.dwSupport & WAVECAPS_DIRECTSOUND) {
lpDSEnumCallback((LPGUID)&DSDEVID_WinePlayback, TRACE("- Device %u supports DirectSound\n", wod);
"WINE DirectSound", "sound", enumerate_devices(lpDSEnumCallback, lpContext);
lpContext); return DS_OK;
#endif }
}
return DS_OK; return DS_OK;
} }
...@@ -3615,7 +3634,7 @@ HRESULT WINAPI DirectSoundCreate(REFGUID lpGUID,LPDIRECTSOUND *ppDS,IUnknown *pU ...@@ -3615,7 +3634,7 @@ HRESULT WINAPI DirectSoundCreate(REFGUID lpGUID,LPDIRECTSOUND *ppDS,IUnknown *pU
return DS_OK; return DS_OK;
} }
/* get dsound configuration */ /* Get dsound configuration */
setup_dsound_options(); setup_dsound_options();
/* Enumerate WINMM audio devices and find the one we want */ /* Enumerate WINMM audio devices and find the one we want */
......
...@@ -250,6 +250,16 @@ WINE REGISTRY Version 2 ...@@ -250,6 +250,16 @@ WINE REGISTRY Version 2
"WaveMapper" = "msacm.drv" "WaveMapper" = "msacm.drv"
"MidiMapper" = "midimap.drv" "MidiMapper" = "midimap.drv"
[dsound]
;; HEL only: Number of waveOut fragments ahead to mix in new buffers.
;"HELmargin" = "48"
;; HEL only: Number of waveOut fragments ahead to queue to driver.
;"HELqueue" = "5"
;; Max number of fragments to prebuffer
;"SndQueueMax" = "28"
;; Min number of fragments to prebuffer
;"SndQueueMin" = "12"
;; sample AppDefaults entries ;; sample AppDefaults entries
;[AppDefaults\\iexplore.exe\\DllOverrides] ;[AppDefaults\\iexplore.exe\\DllOverrides]
;"shlwapi" = "native" ;"shlwapi" = "native"
...@@ -267,5 +277,10 @@ WINE REGISTRY Version 2 ...@@ -267,5 +277,10 @@ WINE REGISTRY Version 2
; ;
;[AppDefaults\\sol.exe\\Version] ;[AppDefaults\\sol.exe\\Version]
;"Windows" = "nt40" ;"Windows" = "nt40"
;
;; Some games (Quake 2, UT) refuse to accept emulated dsound devices.
;; You can add an AppDefault entry like this for such cases.
;[AppDefaults\\pickygame.exe\\dsound]
;"EmulDriver" = "N"
# </wineconf> # </wineconf>
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