[WINEALSA] open and volume fixes

Robert Reif reif at earthlink.net
Sun Jun 5 19:46:35 CDT 2005


Don't open device if already open.
Don't need opened device to get/set volume.
-------------- next part --------------
Index: dlls/winmm/winealsa/audio.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winealsa/audio.c,v
retrieving revision 1.82
diff -p -u -r1.82 audio.c
--- dlls/winmm/winealsa/audio.c	5 Jun 2005 19:18:52 -0000	1.82
+++ dlls/winmm/winealsa/audio.c	6 Jun 2005 00:09:21 -0000
@@ -1523,6 +1523,7 @@ static	void	wodPlayer_Reset(WINE_WAVEOUT
     DWORD		        param;
     HANDLE		        ev;
     int                         err;
+    TRACE("(%p)\n", wwo);
 
     /* flush all possible output */
     wait_for_poll(wwo->handle, wwo->ufds, wwo->count);
@@ -1800,6 +1801,11 @@ static DWORD wodOpen(WORD wDevID, LPWAVE
 
     wwo = &WOutDev[wDevID];
 
+    if (wwo->handle != NULL) {
+        WARN("already allocated\n");
+        return MMSYSERR_ALLOCATED;
+    }
+
     if ((dwFlags & WAVE_DIRECTSOUND) && !(wwo->caps.dwSupport & WAVECAPS_DIRECTSOUND))
 	/* not supported, ignore it */
 	dwFlags &= ~WAVE_DIRECTSOUND;
@@ -2218,7 +2224,7 @@ static DWORD wodGetVolume(WORD wDevID, L
     DWORD              rc;
 
     TRACE("(%u, %p);\n", wDevID, lpdwVol);
-    if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].handle == NULL) {
+    if (wDevID >= MAX_WAVEOUTDRV) {
 	WARN("bad device ID !\n");
 	return MMSYSERR_BADDEVICEID;
     }
@@ -2259,7 +2265,7 @@ static DWORD wodSetVolume(WORD wDevID, D
     DWORD              rc;
 
     TRACE("(%u, %08lX);\n", wDevID, dwParam);
-    if (wDevID >= MAX_WAVEOUTDRV || WOutDev[wDevID].handle == NULL) {
+    if (wDevID >= MAX_WAVEOUTDRV) {
 	WARN("bad device ID !\n");
 	return MMSYSERR_BADDEVICEID;
     }
@@ -3323,6 +3329,11 @@ static DWORD widOpen(WORD wDevID, LPWAVE
     }
 
     wwi = &WInDev[wDevID];
+
+    if (wwi->handle != NULL) {
+        WARN("already allocated\n");
+        return MMSYSERR_ALLOCATED;
+    }
 
     if ((dwFlags & WAVE_DIRECTSOUND) && !(wwi->dwSupport & WAVECAPS_DIRECTSOUND))
 	/* not supported, ignore it */


More information about the wine-patches mailing list