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".
diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c index 3fd6603..d58605b 100644 --- a/dlls/dsound/dsound_main.c +++ b/dlls/dsound/dsound_main.c
@@ -288,6 +288,22 @@ static int ds_snd_queue_max = DS_SND_QUEUE_MAX; 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 */ @@ -341,8 +357,8 @@ /* get options */ 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 )) ds_hel_margin = atoi(buffer); @@ -387,18 +403,21 @@ LPDSENUMCALLBACKA lpDSEnumCallback, LPVOID lpContext) { + WAVEOUTCAPSA wcaps; + unsigned devs, wod; + TRACE("lpDSEnumCallback = %p, lpContext = %p\n", lpDSEnumCallback, lpContext); -#ifdef HAVE_OSS - if (lpDSEnumCallback != NULL) - if (lpDSEnumCallback(NULL, "Primary DirectSound Driver", - "sound", lpContext)) - lpDSEnumCallback((LPGUID)&DSDEVID_WinePlayback, - "WINE DirectSound", "sound", - lpContext); -#endif - + devs = waveOutGetNumDevs(); + for (wod = 0; wod < devs; ++wod) { + waveOutGetDevCapsA(wod, &wcaps, sizeof(wcaps)); + if (wcaps.dwSupport & WAVECAPS_DIRECTSOUND) { + TRACE("- Device %u supports DirectSound\n", wod); + enumerate_devices(lpDSEnumCallback, lpContext); + return DS_OK; + } + } return DS_OK; } @@ -3615,7 +3634,7 @@ return DS_OK; } - /* get dsound configuration */ + /* Get dsound configuration */ setup_dsound_options(); /* Enumerate WINMM audio devices and find the one we want */
diff --git a/documentation/samples/config b/documentation/samples/config index 3a1a3d6..589f667 100644 --- a/documentation/samples/config +++ b/documentation/samples/config
@@ -250,6 +250,16 @@ "WaveMapper" = "msacm.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 ;[AppDefaults\\iexplore.exe\\DllOverrides] ;"shlwapi" = "native" @@ -267,5 +277,10 @@ ; ;[AppDefaults\\sol.exe\\Version] ;"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>