wave handling

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

 



it seems latest winmm allows to call acm when a device doesn't support a
given format (and allow an automatic conversion) while processing
wave(Out|In)Open
this patch implements this feature (as well as the WAVE_FORMAT_DIRECT
which turns this feature off)
it also requires the other patch to wavemapper to be applied

A+
Name:          womap
ChangeLog:     let wave(Out|In)Open call the wave mapper when the low level device doesn't handle the wave descriptor
License:       X11
GenDate:       2002/10/06 19:18:18 UTC
ModifiedFiles: dlls/winmm/mmsystem.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mmsystem.c,v
retrieving revision 1.69
diff -u -u -r1.69 mmsystem.c
--- dlls/winmm/mmsystem.c	12 Sep 2002 22:07:04 -0000	1.69
+++ dlls/winmm/mmsystem.c	6 Oct 2002 19:16:45 -0000
@@ -3794,19 +3794,31 @@
     wod.dwInstance = dwInstance;
     wod.dnDevNode = 0L;
 
-    if (dwFlags & WAVE_MAPPED) {
-	wod.uMappedDeviceID = uDeviceID;
-	uDeviceID = WAVE_MAPPER;
-    } else {
-	wod.uMappedDeviceID = -1;
+    for (;;) {
+        if (dwFlags & WAVE_MAPPED) {
+            wod.uMappedDeviceID = uDeviceID;
+            uDeviceID = WAVE_MAPPER;
+        } else {
+            wod.uMappedDeviceID = -1;
+        }
+        wmld->uDeviceID = uDeviceID;
+    
+        dwRet = MMDRV_Open(wmld, (uType == MMDRV_WAVEOUT) ? WODM_OPEN : WIDM_OPEN, 
+                           (DWORD)&wod, dwFlags);
+
+        if (dwRet != WAVERR_BADFORMAT ||
+            (dwFlags & (WAVE_MAPPED|WAVE_FORMAT_DIRECT)) != 0) break;
+        /* if we ask for a format which isn't supported by the physical driver, 
+         * let's try to map it through the wave mapper (except, if we already tried
+         * or user didn't allow us to use acm codecs)
+         */
+        dwFlags |= WAVE_MAPPED;
+        /* we shall loop only one */
     }
-    wmld->uDeviceID = uDeviceID;
-
-    dwRet = MMDRV_Open(wmld, (uType == MMDRV_WAVEOUT) ? WODM_OPEN : WIDM_OPEN, (DWORD)&wod, dwFlags);
 
     if ((dwFlags & WAVE_FORMAT_QUERY) || dwRet != MMSYSERR_NOERROR) {
-	MMDRV_Free(handle, wmld);
-	handle = 0;
+        MMDRV_Free(handle, wmld);
+        handle = 0;
     }
 
     if (lphndl != NULL) *lphndl = handle;
@@ -3965,7 +3977,7 @@
 			DWORD dwInstance, DWORD dwFlags)
 {
     return MMSYSTEM_waveOpen(lphWaveOut, uDeviceID, MMDRV_WAVEOUT, lpFormat,
-			     dwCallback, dwInstance, dwFlags, TRUE);
+                             dwCallback, dwInstance, dwFlags, TRUE);
 }
 
 /**************************************************************************
@@ -3984,7 +3996,7 @@
      * (0xFFFFFFFF and not 0x0000FFFF)
      */
     ret = MMSYSTEM_waveOpen(&hWaveOut, (uDeviceID == (UINT16)-1) ? (UINT)-1 : uDeviceID,
-			    MMDRV_WAVEOUT, lpFormat, dwCallback, dwInstance, dwFlags, FALSE);
+                            MMDRV_WAVEOUT, lpFormat, dwCallback, dwInstance, dwFlags, FALSE);
 
     if (lphWaveOut != NULL) *lphWaveOut = HWAVEOUT_16(hWaveOut);
     return ret;
@@ -4608,7 +4620,7 @@
 		       DWORD dwInstance, DWORD dwFlags)
 {
     return MMSYSTEM_waveOpen(lphWaveIn, uDeviceID, MMDRV_WAVEIN, lpFormat,
-			     dwCallback, dwInstance, dwFlags, TRUE);
+                             dwCallback, dwInstance, dwFlags, TRUE);
 }
 
 /**************************************************************************

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

  Powered by Linux