wavemapper
Eric Pouech
pouech-eric at wanadoo.fr
Fri May 9 14:39:40 CDT 2003
if a wave device isn't correctly initialized, or if we have issue with
it, there's no need keeping on trying like hell any possible format
this patch stops trying for new formats if the device runs havoc
A+
--
Eric Pouech
-------------- next part --------------
Name: mm_err
ChangeLog: stop wavemap lookup if a device isn't functional (spotted by Lionel Ulmer)
License: X11
GenDate: 2003/05/09 19:36:52 UTC
ModifiedFiles: dlls/winmm/wineoss/audio.c dlls/winmm/wavemap/wavemap.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/wineoss/audio.c,v
retrieving revision 1.88
diff -u -u -r1.88 audio.c
--- dlls/winmm/wineoss/audio.c 2 May 2003 20:16:20 -0000 1.88
+++ dlls/winmm/wineoss/audio.c 8 May 2003 19:55:34 -0000
@@ -284,7 +284,7 @@
*/
if (rc != 0 && errno != EINVAL) {
ERR("ioctl(%s, SNDCTL_DSP_SETDUPLEX) failed (%s)\n", ossdev->dev_name, strerror(errno));
- goto error;
+ goto error2;
}
}
@@ -292,7 +292,7 @@
rc = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &ossdev->audio_fragment);
if (rc != 0) {
ERR("ioctl(%s, SNDCTL_DSP_SETFRAGMENT) failed (%s)\n", ossdev->dev_name, strerror(errno));
- goto error;
+ goto error2;
}
}
@@ -350,6 +350,9 @@
error:
close(fd);
return WAVERR_BADFORMAT;
+ error2:
+ close(fd);
+ return MMSYSERR_ERROR;
}
/******************************************************************
@@ -1455,7 +1479,7 @@
audio_buf_info info;
DWORD ret;
- TRACE("(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
+ TRACE("(%u, %p[cb=%08lx], %08lX);\n", wDevID, lpDesc, lpDesc->dwCallback, dwFlags);
if (lpDesc == NULL) {
WARN("Invalid Parameter !\n");
return MMSYSERR_INVALPARAM;
Index: dlls/winmm/wavemap/wavemap.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/wavemap/wavemap.c,v
retrieving revision 1.30
diff -u -u -r1.30 wavemap.c
--- dlls/winmm/wavemap/wavemap.c 10 Mar 2003 19:03:08 -0000 1.30
+++ dlls/winmm/wavemap/wavemap.c 9 May 2003 19:36:33 -0000
@@ -185,8 +185,11 @@
/* try some ACM stuff */
#define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
- if (wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT) == MMSYSERR_NOERROR) \
- {wom->avgSpeedInner = wfx.nAvgBytesPerSec; goto found;}
+ switch (wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
+ case MMSYSERR_NOERROR: wom->avgSpeedInner = wfx.nAvgBytesPerSec; goto found; \
+ case WAVERR_BADFORMAT: break; \
+ default: goto error; \
+ }
/* Our resampling algorithm is quite primitive so first try
* to just change the bit depth and number of channels
@@ -248,6 +251,9 @@
*lpdwUser = (DWORD)wom;
}
return MMSYSERR_NOERROR;
+error:
+ HeapFree(GetProcessHeap(), 0, wom);
+ return MMSYSERR_ERROR;
}
static DWORD wodClose(WAVEMAPDATA* wom)
@@ -627,8 +633,11 @@
/* try some ACM stuff */
#define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
- if (widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT) == MMSYSERR_NOERROR) \
- {wim->avgSpeedInner = wfx.nAvgBytesPerSec; goto found;}
+ switch (widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
+ case MMSYSERR_NOERROR: wim->avgSpeedInner = wfx.nAvgBytesPerSec; goto found; \
+ case WAVERR_BADFORMAT: break; \
+ default: goto error; \
+ }
for (i = ndlo; i < ndhi; i++) {
wfx.nSamplesPerSec=lpDesc->lpFormat->nSamplesPerSec;
@@ -689,6 +698,9 @@
}
TRACE("Ok (stream=%08lx)\n", (DWORD)wim->hAcmStream);
return MMSYSERR_NOERROR;
+error:
+ HeapFree(GetProcessHeap(), 0, wim);
+ return MMSYSERR_ERROR;
}
static DWORD widClose(WAVEMAPDATA* wim)
More information about the wine-patches
mailing list