Simplify Jack's format check

Francois Gouget fgouget at codeweavers.com
Tue May 4 06:59:34 CDT 2004


Jack only supports 16 bit sound (or, at any rate, the intersection of 
the supported set of 'BitsPerSample' values in Wine and Jack is the 
'16bit' singleton). So the format checks in wodOpen() and widOpen() can 
be simplified.


Changelog:

  * dlls/winmm/winejack/audio.c

    Francois Gouget <fgouget at codeweavers.com>
    winejack.drv only supports 16bit sound so we can simplify the sound 
format checks.

-- 
Francois Gouget
fgouget at codeweavers.com

-------------- next part --------------
Index: dlls/winmm/winejack/audio.c
===================================================================
RCS file: /var/cvs/wine/dlls/winmm/winejack/audio.c,v
retrieving revision 1.9
diff -u -r1.9 audio.c
--- a/dlls/winmm/winejack/audio.c	26 Apr 2004 20:04:00 -0000	1.9
+++ b/dlls/winmm/winejack/audio.c	4 May 2004 11:17:29 -0000
@@ -1231,22 +1238,17 @@
       return MMSYSERR_ALLOCATED;
     }
 
-    /* make sure we aren't being opened in 8 bit mode */
-    if(lpDesc->lpFormat->wBitsPerSample == 8)
-    {
-      TRACE("8bits per sample unsupported, returning WAVERR_BADFORMAT\n");
-      return WAVERR_BADFORMAT;
-    }
-
-    /* only PCM format is supported so far... */
+    /* Only the PCM format is supported so far...
+     * Also we only support 16 bit mode.
+     */
     if (lpDesc->lpFormat->wFormatTag != WAVE_FORMAT_PCM ||
       lpDesc->lpFormat->nChannels == 0 ||
       lpDesc->lpFormat->nSamplesPerSec == 0 ||
-      (lpDesc->lpFormat->wBitsPerSample!=8 && lpDesc->lpFormat->wBitsPerSample!=16))
+      lpDesc->lpFormat->wBitsPerSample != 16)
     {
-      WARN("Bad format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n",
+      WARN("Bad format: tag=%04X nChannels=%d nSamplesPerSec=%ld wBitsPerSample=%d !\n",
        lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels,
-       lpDesc->lpFormat->nSamplesPerSec);
+       lpDesc->lpFormat->nSamplesPerSec, lpDesc->lpFormat->wBitsPerSample);
       return WAVERR_BADFORMAT;
     }
 
@@ -2104,22 +2106,17 @@
       return MMSYSERR_ALLOCATED;
     }
 
-    /* make sure we aren't being opened in 8 bit mode */
-    if(lpDesc->lpFormat->wBitsPerSample == 8)
-    {
-      TRACE("8bits per sample unsupported, returning WAVERR_BADFORMAT\n");
-      return WAVERR_BADFORMAT;
-    }
-
-    /* only PCM format is supported so far... */
+    /* Only the PCM format is supported so far...
+     * Also we only support 16 bit mode.
+     */
     if (lpDesc->lpFormat->wFormatTag != WAVE_FORMAT_PCM ||
       lpDesc->lpFormat->nChannels == 0 ||
       lpDesc->lpFormat->nSamplesPerSec == 0 ||
-      (lpDesc->lpFormat->wBitsPerSample!=8 && lpDesc->lpFormat->wBitsPerSample!=16))
+      lpDesc->lpFormat->wBitsPerSample!=16)
     {
-      WARN("Bad format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n",
+      WARN("Bad format: tag=%04X nChannels=%d nSamplesPerSec=%ld wBitsPerSample=%d !\n",
        lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels,
-       lpDesc->lpFormat->nSamplesPerSec);
+       lpDesc->lpFormat->nSamplesPerSec, lpDesc->lpFormat->wBitsPerSample);
       return WAVERR_BADFORMAT;
     }
 


More information about the wine-patches mailing list