RESUBMIT: PATCH: DirectSound
Johan Gill
johane at lysator.liu.se
Tue May 28 10:28:53 CDT 2002
This patch should be used instead. Now all devices are queried for
dsound support.
Changelog: Only enumerate DirectSound devices if any sound device in the
system supports the WINE implementation of DirectSound. I have 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 15:21:23 -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,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 */
Index: wine/dlls/version/info.c
===================================================================
RCS file: /home/wine/wine/dlls/version/info.c,v
retrieving revision 1.34
diff -u -r1.34 info.c
--- wine/dlls/version/info.c 2 Apr 2002 02:45:09 -0000 1.34
+++ wine/dlls/version/info.c 28 May 2002 15:21:24 -0000
@@ -443,7 +443,7 @@
if(len == 0xFFFFFFFF) return 0;
if(len) return len;
/* Temporary workaround a broken behaviour of the 16-bit loader */
- len = 0; /* VERSION_GetFileVersionInfo_16(filename, handle, 0, NULL); */
+ len = VERSION_GetFileVersionInfo_16(filename, handle, 0, NULL);
/* 0xFFFFFFFF means: file exists, but VERSION_INFO not found */
if(len == 0xFFFFFFFF) return 0;
if(len) return len;
@@ -513,7 +513,7 @@
if(len)
goto DO_CONVERT;
/* Temporary workaround a broken behaviour of the 16-bit loader */
- len = 0; /* VERSION_GetFileVersionInfo_16(filename, &handle, datasize, data); */
+ len = VERSION_GetFileVersionInfo_16(filename, &handle, datasize, data);
/* 0xFFFFFFFF means: file exists, but VERSION_INFO not found */
if(len == 0xFFFFFFFF) return FALSE;
if(len)
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 15:21:24 -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