wineoss/wavemap and i810 sound cards

Francois Gouget fgouget at codeweavers.com
Wed Dec 11 03:30:39 CST 2002


Here's the problem: apparently i810 sound cards (and the corresponding 
OSS drivers) only accept 48kHz sound in 16 bit stereo. So if an 
application uses winmm to play a sound in any other format, winmm has to 
use the wave mapper to do the conversion to that format.

But msacm refuses to do a conversion to 48kHz sound because that 
sampling rate is not in the 'supported formats' list: see around line 
870 of 'dlls/msacm/pcmconverter.c'. Hence the attached patch to 
pcmconverter. The changes in wavemap.c are just so that we at least try 
to see if we could convert to that sampling rate.

However, why only support conversion between these specific formats? Why 
not support anything between 100 and 100000Hz for instance? That would 
nicely match the range returned by DirectSound...

Does this patch look ok?
Should I rewrite it using the above range instead? (Or rather, why 
should I not rewrite it that way?)

-- 
Francois Gouget
fgouget at codeweavers.com

-------------- next part --------------
Index: dlls/msacm/pcmconverter.c
===================================================================
RCS file: /home/wine/wine/dlls/msacm/pcmconverter.c,v
retrieving revision 1.13
diff -u -r1.13 pcmconverter.c
--- dlls/msacm/pcmconverter.c	2 Dec 2002 18:10:59 -0000	1.13
+++ dlls/msacm/pcmconverter.c	11 Dec 2002 02:54:56 -0000
@@ -103,6 +103,7 @@
     {1,  8, 11025}, {2,  8, 11025}, {1, 16, 11025}, {2, 16, 11025},
     {1,  8, 22050}, {2,  8, 22050}, {1, 16, 22050}, {2, 16, 22050},
     {1,  8, 44100}, {2,  8, 44100}, {1, 16, 44100}, {2, 16, 44100},
+    {1,  8, 48000}, {2,  8, 48000}, {1, 16, 48000}, {2, 16, 48000},
 };
 
 /***********************************************************************
Index: dlls/winmm/wavemap/wavemap.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/wavemap/wavemap.c,v
retrieving revision 1.24
diff -u -r1.24 wavemap.c
--- dlls/winmm/wavemap/wavemap.c	31 Oct 2002 00:54:27 -0000	1.24
+++ dlls/winmm/wavemap/wavemap.c	11 Dec 2002 02:55:03 -0000
@@ -189,26 +192,30 @@
                         {wom->avgSpeedInner = wfx.nAvgBytesPerSec; goto found;}
 
         for (i = ndlo; i < ndhi; i++) {
             /* first try with same stereo/mono option as source */
             wfx.nChannels = lpDesc->lpFormat->nChannels;
+            TRY(48000, 16);
             TRY(44100, 16);
             TRY(22050, 16);
             TRY(11025, 16);
 
             /* 2^3 => 1, 1^3 => 2, so if stereo, try mono (and the other way around) */
             wfx.nChannels ^= 3;
+            TRY(48000, 16);
             TRY(44100, 16);
             TRY(22050, 16);
             TRY(11025, 16);
 
             /* first try with same stereo/mono option as source */
             wfx.nChannels = lpDesc->lpFormat->nChannels;
+            TRY(48000, 8);
             TRY(44100, 8);
             TRY(22050, 8);
             TRY(11025, 8);
 
             /* 2^3 => 1, 1^3 => 2, so if stereo, try mono (and the other way around) */
             wfx.nChannels ^= 3;
+            TRY(48000, 8);
             TRY(44100, 8);
             TRY(22050, 8);
             TRY(11025, 8);
@@ -217,7 +225,8 @@
     }
 
     HeapFree(GetProcessHeap(), 0, wom);
-    return MMSYSERR_ALLOCATED;
+    return WAVERR_BADFORMAT;
+
 found:
     if (dwFlags & WAVE_FORMAT_QUERY) {
 	*lpdwUser = 0L;


More information about the wine-devel mailing list