Commit 2cb32626 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

winmm: Don't allow to set time division property while playing.

parent 8ef224fa
......@@ -885,6 +885,12 @@ static void test_midiStream(UINT udev, HWND hwnd)
ok(ret > expected && ret < expected + MARGIN, "expected greater than %ums, got %ums\n", expected, ret);
expected = ret;
/* shouldn't set time division property while playing */
midiprop.tdiv.cbStruct = sizeof(midiprop.tdiv);
midiprop.tdiv.dwTimeDiv = 24;
rc = midiStreamProperty(hm, (void*)&midiprop, MIDIPROP_SET | MIDIPROP_TIMEDIV);
ok(rc == MMSYSERR_INVALPARAM, "midiStreamProperty(SET|TIMEDIV, dev=%d) rc=%s\n", udev, mmsys_error(rc));
ret = WaitForSingleObject(records.done, INFINITE);
ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed, got %d\n", ret);
......
......@@ -1539,9 +1539,13 @@ MMRESULT WINAPI midiStreamProperty(HMIDISTRM hMidiStrm, LPBYTE lpPropData, DWORD
ret = MMSYSERR_INVALPARAM;
} else if (dwProperty & MIDIPROP_SET) {
EnterCriticalSection(&lpMidiStrm->lock);
lpMidiStrm->dwTimeDiv = mptd->dwTimeDiv;
if (lpMidiStrm->status != MSM_STATUS_PLAYING) {
lpMidiStrm->dwTimeDiv = mptd->dwTimeDiv;
TRACE("Setting time div to %d\n", mptd->dwTimeDiv);
}
else
ret = MMSYSERR_INVALPARAM;
LeaveCriticalSection(&lpMidiStrm->lock);
TRACE("Setting time div to %d\n", mptd->dwTimeDiv);
} else if (dwProperty & MIDIPROP_GET) {
mptd->dwTimeDiv = lpMidiStrm->dwTimeDiv;
TRACE("Getting time div <= %d\n", mptd->dwTimeDiv);
......
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