winmm: Support TIME_MIDI position in MIDI stream.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0a788caf8b
commit
95c21f3f94
|
@ -698,7 +698,7 @@ static void test_midiStream(UINT udev, HWND hwnd)
|
||||||
|
|
||||||
test_position(hm, TIME_MS, TIME_MS);
|
test_position(hm, TIME_MS, TIME_MS);
|
||||||
test_position(hm, TIME_TICKS, TIME_TICKS);
|
test_position(hm, TIME_TICKS, TIME_TICKS);
|
||||||
todo_wine test_position(hm, TIME_MIDI, TIME_MIDI);
|
test_position(hm, TIME_MIDI, TIME_MIDI);
|
||||||
test_position(hm, TIME_SMPTE, TIME_MS);
|
test_position(hm, TIME_SMPTE, TIME_MS);
|
||||||
test_position(hm, TIME_SAMPLES, TIME_MS);
|
test_position(hm, TIME_SAMPLES, TIME_MS);
|
||||||
test_position(hm, TIME_BYTES, TIME_MS);
|
test_position(hm, TIME_BYTES, TIME_MS);
|
||||||
|
@ -933,7 +933,7 @@ static void test_midiStream(UINT udev, HWND hwnd)
|
||||||
/* TIME_MIDI value is a quarter of TIME_TICKS, rounded */
|
/* TIME_MIDI value is a quarter of TIME_TICKS, rounded */
|
||||||
expected = (ret + midiprop.tdiv.dwTimeDiv/8) / (midiprop.tdiv.dwTimeDiv/4);
|
expected = (ret + midiprop.tdiv.dwTimeDiv/8) / (midiprop.tdiv.dwTimeDiv/4);
|
||||||
ret = get_position(hm, TIME_MIDI);
|
ret = get_position(hm, TIME_MIDI);
|
||||||
todo_wine ok(ret == expected, "expected song pointer %u, got %u\n", expected, ret);
|
ok(ret == expected, "expected song pointer %u, got %u\n", expected, ret);
|
||||||
|
|
||||||
ok(records.count == 2, "expected 2 MM_MOM_DONE messages, got %d\n", records.count);
|
ok(records.count == 2, "expected 2 MM_MOM_DONE messages, got %d\n", records.count);
|
||||||
|
|
||||||
|
|
|
@ -1508,9 +1508,17 @@ MMRESULT WINAPI midiStreamPosition(HMIDISTRM hMidiStrm, LPMMTIME lpMMT, UINT cbm
|
||||||
} else {
|
} else {
|
||||||
EnterCriticalSection(&lpMidiStrm->lock);
|
EnterCriticalSection(&lpMidiStrm->lock);
|
||||||
switch (lpMMT->wType) {
|
switch (lpMMT->wType) {
|
||||||
default:
|
case TIME_MIDI:
|
||||||
FIXME("Unsupported time type %x\n", lpMMT->wType);
|
if (lpMidiStrm->dwTimeDiv < 0x8000) {
|
||||||
/* fall through */
|
DWORD tdiv, pulses;
|
||||||
|
tdiv = (lpMidiStrm->dwTimeDiv > 24) ? lpMidiStrm->dwTimeDiv : 24;
|
||||||
|
pulses = midistream_get_current_pulse(lpMidiStrm);
|
||||||
|
lpMMT->u.midi.songptrpos = (pulses + tdiv/8) / (tdiv/4);
|
||||||
|
if (!lpMMT->u.midi.songptrpos && pulses) lpMMT->u.midi.songptrpos++;
|
||||||
|
TRACE("=> song position %d (pulses %u, tdiv %u)\n", lpMMT->u.midi.songptrpos, pulses, tdiv);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
case TIME_BYTES:
|
case TIME_BYTES:
|
||||||
case TIME_SAMPLES:
|
case TIME_SAMPLES:
|
||||||
lpMMT->wType = TIME_MS;
|
lpMMT->wType = TIME_MS;
|
||||||
|
@ -1523,6 +1531,13 @@ MMRESULT WINAPI midiStreamPosition(HMIDISTRM hMidiStrm, LPMMTIME lpMMT, UINT cbm
|
||||||
lpMMT->u.ticks = midistream_get_current_pulse(lpMidiStrm);
|
lpMMT->u.ticks = midistream_get_current_pulse(lpMidiStrm);
|
||||||
TRACE("=> %d ticks\n", lpMMT->u.ticks);
|
TRACE("=> %d ticks\n", lpMMT->u.ticks);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
FIXME("Unsupported time type %x\n", lpMMT->wType);
|
||||||
|
/* use TIME_MS instead */
|
||||||
|
lpMMT->wType = TIME_MS;
|
||||||
|
lpMMT->u.ms = midistream_get_playing_position(lpMidiStrm);
|
||||||
|
TRACE("=> %d ms\n", lpMMT->u.ms);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&lpMidiStrm->lock);
|
LeaveCriticalSection(&lpMidiStrm->lock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue