Don't open device if already open.

Don't need opened device to get/set volume.
This commit is contained in:
Robert Reif 2005-06-06 10:03:18 +00:00 committed by Alexandre Julliard
parent 645ec7d6e2
commit 3433d8bb29
1 changed files with 13 additions and 2 deletions

View File

@ -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;