Commit d4b2d48f authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

winmm: More compatible waveIn/Out[Un]Prepare WHDR_* flag handling.

parent b95910cc
......@@ -809,6 +809,29 @@ static void wave_out_test_deviceOut(int device, double duration,
"waveOutUnprepareHeader(%s): rc=%s\n",dev_name(device),
wave_out_error(rc));
}
ok(frags[0].dwFlags==(interactive ? WHDR_DONE : 0), "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
frags[0].dwFlags |= WHDR_DONE;
rc=waveOutUnprepareHeader(wout, &frags[0], sizeof(frags[0]));
ok(rc==MMSYSERR_NOERROR, "waveOutUnprepareHeader(%d): rc=%s\n",device,wave_out_error(rc));
ok(frags[0].dwFlags==WHDR_DONE, "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
frags[0].dwFlags |= WHDR_INQUEUE;
rc=waveOutPrepareHeader(wout, &frags[0], sizeof(frags[0]));
ok(rc==MMSYSERR_NOERROR, "waveOutPrepareHeader(%d): rc=%s\n",device,wave_out_error(rc));
ok(frags[0].dwFlags==WHDR_PREPARED, "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
frags[0].dwFlags |= WHDR_INQUEUE;
rc=waveOutPrepareHeader(wout, &frags[0], sizeof(frags[0]));
ok(rc==MMSYSERR_NOERROR, "waveOutPrepareHeader(%d): rc=%s\n",device,wave_out_error(rc));
ok(frags[0].dwFlags==(WHDR_PREPARED|WHDR_INQUEUE), "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
frags[0].dwFlags &= ~(WHDR_INQUEUE|WHDR_DONE);
rc=waveOutUnprepareHeader(wout, &frags[0], sizeof(frags[0]));
ok(rc==MMSYSERR_NOERROR, "waveOutUnprepareHeader(%d): rc=%s\n",device,wave_out_error(rc));
ok(frags[0].dwFlags==0, "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
rc=waveOutClose(wout);
ok(rc==MMSYSERR_NOERROR,"waveOutClose(%s): rc=%s\n",dev_name(device),
wave_out_error(rc));
......
......@@ -1517,7 +1517,7 @@ static LRESULT WINMM_PrepareHeader(HWAVE hwave, WAVEHDR *header)
LeaveCriticalSection(&device->lock);
header->dwFlags |= WHDR_PREPARED;
header->dwFlags &= ~WHDR_DONE;
header->dwFlags &= ~(WHDR_DONE|WHDR_INQUEUE); /* flags cleared since w2k */
return MMSYSERR_NOERROR;
}
......@@ -1542,7 +1542,6 @@ static LRESULT WINMM_UnprepareHeader(HWAVE hwave, WAVEHDR *header)
LeaveCriticalSection(&device->lock);
header->dwFlags &= ~WHDR_PREPARED;
header->dwFlags |= WHDR_DONE;
return MMSYSERR_NOERROR;
}
......@@ -2782,8 +2781,8 @@ UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut,
if(!lpWaveOutHdr || uSize < sizeof(WAVEHDR))
return MMSYSERR_INVALPARAM;
if(lpWaveOutHdr->dwFlags & WHDR_INQUEUE)
return WAVERR_STILLPLAYING;
if(lpWaveOutHdr->dwFlags & WHDR_PREPARED)
return MMSYSERR_NOERROR;
return WINMM_PrepareHeader((HWAVE)hWaveOut, lpWaveOutHdr);
}
......@@ -2798,13 +2797,13 @@ UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut,
if(!lpWaveOutHdr || uSize < sizeof(WAVEHDR))
return MMSYSERR_INVALPARAM;
if(!(lpWaveOutHdr->dwFlags & WHDR_PREPARED))
return MMSYSERR_NOERROR;
if(lpWaveOutHdr->dwFlags & WHDR_INQUEUE)
return WAVERR_STILLPLAYING;
if(!(lpWaveOutHdr->dwFlags & WHDR_PREPARED))
return MMSYSERR_NOERROR;
return WINMM_UnprepareHeader((HWAVE)hWaveOut, lpWaveOutHdr);
}
......@@ -3412,8 +3411,8 @@ UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn, WAVEHDR* lpWaveInHdr,
if(!lpWaveInHdr || uSize < sizeof(WAVEHDR))
return MMSYSERR_INVALPARAM;
if(lpWaveInHdr->dwFlags & WHDR_INQUEUE)
return WAVERR_STILLPLAYING;
if(lpWaveInHdr->dwFlags & WHDR_PREPARED)
return MMSYSERR_NOERROR;
return WINMM_PrepareHeader((HWAVE)hWaveIn, lpWaveInHdr);
}
......@@ -3429,12 +3428,12 @@ UINT WINAPI waveInUnprepareHeader(HWAVEIN hWaveIn, WAVEHDR* lpWaveInHdr,
if(!lpWaveInHdr || uSize < sizeof(WAVEHDR))
return MMSYSERR_INVALPARAM;
if(!(lpWaveInHdr->dwFlags & WHDR_PREPARED))
return MMSYSERR_NOERROR;
if(lpWaveInHdr->dwFlags & WHDR_INQUEUE)
return WAVERR_STILLPLAYING;
if(!(lpWaveInHdr->dwFlags & WHDR_PREPARED))
return MMSYSERR_NOERROR;
return WINMM_UnprepareHeader((HWAVE)hWaveIn, lpWaveInHdr);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment