Take advantage of previous wineoss patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Currently DirectSound makes some feeble attempts to find a format supported by the soundcard when DirectSoundCreate8 is called. I say feeble because it does not try 48kHz formats for instance so it would fail on i810 soundcards.
Anyway, with my the patch this becomes unnecessary. DirectSoundCreate can just open a device in the default 22050x8x2 format and let the chips fall where they may. This simplifies the code but may cause trouble with drivers that don't know how to report the actual device format (i.e. mostly winealsa).


Changelog:

Francois Gouget <fgouget@codeweavers.com>

* dlls/dsound/dsound_main.c

Always open the device in the default 22050x8x2 format, and let it report the actual device format to us


--
Francois Gouget
fgouget@codeweavers.com

Index: dlls/dsound/dsound_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound_main.c,v
retrieving revision 1.68
diff -u -r1.68 dsound_main.c
--- dlls/dsound/dsound_main.c	5 Dec 2002 19:20:36 -0000	1.68
+++ dlls/dsound/dsound_main.c	5 Jan 2003 20:54:41 -0000
@@ -571,7 +571,6 @@
 {
 	IDirectSoundImpl** ippDS=(IDirectSoundImpl**)ppDS;
 	PIDSDRIVER drv = NULL;
-	WAVEOUTCAPSA wcaps;
 	unsigned wod, wodn;
 	HRESULT err = DS_OK;
 
@@ -599,8 +598,6 @@
 	/* FIXME: How do we find the GUID of an audio device? */
 	wod = 0;  /* start at the first audio device */
 
-	/* Get output device caps */
-	waveOutGetDevCapsA(wod, &wcaps, sizeof(wcaps));
 	/* DRV_QUERYDSOUNDIFACE is a "Wine extension" to get the DSound interface */
 	waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0);
 
@@ -638,23 +635,15 @@
 
 	/* Set default wave format (may need it for waveOutOpen) */
 	(*ippDS)->wfx.wFormatTag	= WAVE_FORMAT_PCM;
-	/* default to stereo, if the sound card can do it */
-	if (wcaps.wChannels > 1)
-		(*ippDS)->wfx.nChannels		= 2;
-	else
-		(*ippDS)->wfx.nChannels		= 1;
-	/* default to 8, if the sound card can do it */
-	if (wcaps.dwFormats & (WAVE_FORMAT_4M08 | WAVE_FORMAT_2M08 | WAVE_FORMAT_1M08 |
-			       WAVE_FORMAT_4S08 | WAVE_FORMAT_2S08 | WAVE_FORMAT_1S08)) {
-		(*ippDS)->wfx.wBitsPerSample	= 8;
-		(*ippDS)->wfx.nBlockAlign	= 1 * (*ippDS)->wfx.nChannels;
-	} else {
-		/* it's probably a 16-bit-only card */
-		(*ippDS)->wfx.wBitsPerSample	= 16;
-		(*ippDS)->wfx.nBlockAlign	= 2 * (*ippDS)->wfx.nChannels;
-	}
-	(*ippDS)->wfx.nSamplesPerSec	= 22050;
-	(*ippDS)->wfx.nAvgBytesPerSec	= 22050 * (*ippDS)->wfx.nBlockAlign;
+        /* We rely on the sound driver to return the actual sound format of 
+         * the device if it does not support 22050x8x2 and is given the 
+         * WAVE_DIRECTSOUND flag.
+         */
+        (*ippDS)->wfx.nSamplesPerSec = 22050;
+        (*ippDS)->wfx.wBitsPerSample = 8;
+        (*ippDS)->wfx.nChannels = 2;
+        (*ippDS)->wfx.nBlockAlign = (*ippDS)->wfx.wBitsPerSample * (*ippDS)->wfx.nChannels / 8;
+        (*ippDS)->wfx.nAvgBytesPerSec = (*ippDS)->wfx.nSamplesPerSec * (*ippDS)->wfx.nBlockAlign;
 
 	/* If the driver requests being opened through MMSYSTEM
 	 * (which is recommended by the DDK), it is supposed to happen
@@ -695,7 +684,7 @@
 	} else {
 		unsigned c;
 
-		/* FIXME: look at wcaps */
+		/* FIXME: We should check the device capabilities */
 		(*ippDS)->drvcaps.dwFlags =
 			DSCAPS_PRIMARY16BIT | DSCAPS_PRIMARYSTEREO;
 		if (ds_emuldriver)

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux