Hi, This is the first of two patches that will fix some problems on soundcards using the i810 audio codec. The main probem with this soundcard is that it only supports a frequency of 48kHz in 16bit stereo mode.
This first patch to dsound queries if the card supports 16bit and if so it uses it, else it uses 8bit. Further it also detects if the card supports stereo or not. The patch was inspired by one from transgaming to rewind but that patch did a bit the opposite (defaulting to 8bit ..). Roderick Colenbrander
Index: dlls/dsound/dsound_main.c =================================================================== RCS file: /home/wine/wine/dlls/dsound/dsound_main.c,v retrieving revision 1.97 diff -u -r1.97 dsound_main.c --- dlls/dsound/dsound_main.c 17 Mar 2004 01:44:15 -0000 1.97 +++ dlls/dsound/dsound_main.c 27 Mar 2004 18:07:35 -0000 @@ -136,7 +136,6 @@ /* - * Setup the dsound options. */ void setup_dsound_options(void) @@ -926,6 +925,7 @@ { IDirectSoundImpl** ippDS=(IDirectSoundImpl**)ppDS; PIDSDRIVER drv = NULL; + WAVEOUTCAPSA woc; unsigned wod, wodn; HRESULT err = DSERR_INVALIDPARAM; GUID devGuid; @@ -1070,14 +1070,30 @@ /* Set default wave format (may need it for waveOutOpen) */ (*ippDS)->wfx.wFormatTag = WAVE_FORMAT_PCM; + + + /* 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. - */ + * the device. If the card does not support stereo mode we use mono and + * if it doesn't support 16bit we use 8bit. */ + waveOutGetDevCapsA((*ippDS)->drvdesc.dnDevNode, &woc, sizeof(woc)); + + /* We should default to stereo when the card supports it */ + if (woc.wChannels > 1) + (*ippDS)->wfx.nChannels = 2; + else + (*ippDS)->wfx.nChannels = 1; + + if (woc.dwFormats & (WAVE_FORMAT_4M16 | WAVE_FORMAT_2M16 | WAVE_FORMAT_1M16 | + WAVE_FORMAT_4S16 | WAVE_FORMAT_2S16 | WAVE_FORMAT_1S16)) { + (*ippDS)->wfx.wBitsPerSample= 16; + (*ippDS)->wfx.nBlockAlign = 2 * (*ippDS)->wfx.nChannels; + } else { + /* The card is likely limited to 8-bit */ + (*ippDS)->wfx.wBitsPerSample= 8; + (*ippDS)->wfx.nBlockAlign = 1 * (*ippDS)->wfx.nChannels; + } (*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; (*ippDS)->wfx.cbSize = 0;