From 3433d8bb29a8fac6d5a53928ee6ac0b20a2272b6 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Mon, 6 Jun 2005 10:03:18 +0000 Subject: [PATCH] Don't open device if already open. Don't need opened device to get/set volume. --- dlls/winmm/winealsa/audio.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/winmm/winealsa/audio.c b/dlls/winmm/winealsa/audio.c index fe06431ac49..c7a7711f41e 100644 --- a/dlls/winmm/winealsa/audio.c +++ b/dlls/winmm/winealsa/audio.c @@ -1523,6 +1523,7 @@ static void wodPlayer_Reset(WINE_WAVEOUT* wwo) 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, LPWAVEOPENDESC lpDesc, DWORD dwFlags) 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, LPDWORD lpdwVol) 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, DWORD dwParam) 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; } @@ -3324,6 +3330,11 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) 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 */ dwFlags &= ~WAVE_DIRECTSOUND; -- 2.11.4.GIT