PATCH: DirectSound

Johan Gill johane at lysator.liu.se
Tue May 28 07:44:49 CDT 2002


Now with patch :)

Changelog: Only enumerate DirectSound devices if the first sound device
in the system supports the WINE implementation of DirectSound. I also
added some entries to the sample config file and changed the values of
the "EmulDriver" key to "Y"/"N".

Fixes: Sound in the game "Riven" on systems with soundcards without mmap().

/Johan Gill, johane at lysator.liu.se


-------------- next part --------------
Index: wine/dlls/dsound/dsound_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound_main.c,v
retrieving revision 1.57
diff -u -r1.57 dsound_main.c
--- wine/dlls/dsound/dsound_main.c	11 May 2002 22:53:00 -0000	1.57
+++ wine/dlls/dsound/dsound_main.c	28 May 2002 12:28:31 -0000
@@ -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,15 @@
 	LPDSENUMCALLBACKA lpDSEnumCallback,
 	LPVOID lpContext)
 {
+	WAVEOUTCAPSA wcaps;
+
 	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
-
+	waveOutGetDevCapsA(0, &wcaps, sizeof(wcaps));
+	if (wcaps.dwSupport & WAVECAPS_DIRECTSOUND) {
+		enumerate_devices(lpDSEnumCallback, lpContext);
+	}
 	return DS_OK;
 }
 
@@ -3615,7 +3628,7 @@
 		return DS_OK;
 	}
 
-	/* get dsound configuration */
+	/* Get dsound configuration */
 	setup_dsound_options();
 
 	/* Enumerate WINMM audio devices and find the one we want */
Index: wine/documentation/samples/config
===================================================================
RCS file: /home/wine/wine/documentation/samples/config,v
retrieving revision 1.22
diff -u -r1.22 config
--- wine/documentation/samples/config	23 May 2002 19:35:18 -0000	1.22
+++ wine/documentation/samples/config	28 May 2002 12:28:31 -0000
@@ -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>


More information about the wine-patches mailing list