mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 18:37:17 +00:00
dmime: Fix tempo track GetParam with GUID_TempoParam implementation.
This commit is contained in:
parent
92959b315b
commit
2d1f46c221
|
@ -140,42 +140,32 @@ static HRESULT WINAPI tempo_track_Play(IDirectMusicTrack8 *iface, void *pStateDa
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI tempo_track_GetParam(IDirectMusicTrack8 *iface, REFGUID type, MUSIC_TIME time,
|
||||
MUSIC_TIME *next, void *param)
|
||||
static HRESULT WINAPI tempo_track_GetParam(IDirectMusicTrack8 *iface, REFGUID type, MUSIC_TIME music_time,
|
||||
MUSIC_TIME *next_time, void *param)
|
||||
{
|
||||
IDirectMusicTempoTrack *This = impl_from_IDirectMusicTrack8(iface);
|
||||
DMUS_TEMPO_PARAM *prm = param;
|
||||
unsigned int i;
|
||||
DMUS_IO_TEMPO_ITEM *item = This->items, *end = item + This->count;
|
||||
DMUS_TEMPO_PARAM *tempo = param;
|
||||
|
||||
TRACE("(%p, %s, %ld, %p, %p)\n", This, debugstr_dmguid(type), time, next, param);
|
||||
TRACE("(%p, %s, %ld, %p, %p)\n", This, debugstr_dmguid(type), music_time, next_time, param);
|
||||
|
||||
if (!param)
|
||||
return E_POINTER;
|
||||
if (!IsEqualGUID(type, &GUID_TempoParam))
|
||||
return DMUS_E_GET_UNSUPPORTED;
|
||||
if (!param) return E_POINTER;
|
||||
if (!IsEqualGUID(type, &GUID_TempoParam)) return DMUS_E_GET_UNSUPPORTED;
|
||||
if (item == end) return DMUS_E_NOT_FOUND;
|
||||
|
||||
FIXME("Partial support for GUID_TempoParam\n");
|
||||
tempo->mtTime = item->lTime - music_time;
|
||||
tempo->dblTempo = item->dblTempo;
|
||||
|
||||
if (next)
|
||||
*next = 0;
|
||||
prm->mtTime = 0;
|
||||
prm->dblTempo = 0.123456;
|
||||
|
||||
for (i = 0; i < This->count; i++) {
|
||||
if (This->items[i].lTime <= time) {
|
||||
MUSIC_TIME ofs = This->items[i].lTime - time;
|
||||
if (ofs > prm->mtTime) {
|
||||
prm->mtTime = ofs;
|
||||
prm->dblTempo = This->items[i].dblTempo;
|
||||
}
|
||||
if (next && This->items[i].lTime > time && This->items[i].lTime < *next)
|
||||
*next = This->items[i].lTime;
|
||||
}
|
||||
for (; item < end; item++)
|
||||
{
|
||||
MUSIC_TIME time = item->lTime - music_time;
|
||||
if (next_time) *next_time = item->lTime - music_time;
|
||||
if (time > 0) break;
|
||||
tempo->mtTime = time;
|
||||
tempo->dblTempo = item->dblTempo;
|
||||
}
|
||||
|
||||
if (0.123456 == prm->dblTempo)
|
||||
return DMUS_E_NOT_FOUND;
|
||||
|
||||
if (next_time && item == end) *next_time = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -4019,45 +4019,45 @@ static void test_tempo_track_play(void)
|
|||
hr = IDirectMusicSegment_GetParam(segment, &GUID_TempoParam, -1, DMUS_SEG_ALLTRACKS, 0, NULL, NULL);
|
||||
ok(hr == E_POINTER, "got %#lx\n", hr);
|
||||
hr = IDirectMusicSegment_GetParam(segment, &GUID_TempoParam, -1, DMUS_SEG_ALLTRACKS, 0, NULL, ¶m);
|
||||
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
|
||||
memset(¶m, 0xcd, sizeof(param));
|
||||
next_time = 0xdeadbeef;
|
||||
hr = IDirectMusicSegment_GetParam(segment, &GUID_TempoParam, -1, DMUS_SEG_ALLTRACKS, 0, &next_time, ¶m);
|
||||
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
|
||||
todo_wine ok(next_time == 100, "got next_time %lu\n", next_time);
|
||||
todo_wine ok(param.mtTime == 100, "got mtTime %ld\n", param.mtTime);
|
||||
todo_wine ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(next_time == 100, "got next_time %lu\n", next_time);
|
||||
ok(param.mtTime == 100, "got mtTime %ld\n", param.mtTime);
|
||||
ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
hr = IDirectMusicSegment_GetParam(segment, &GUID_TempoParam, -1, DMUS_SEG_ALLTRACKS, 100, &next_time, ¶m);
|
||||
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
|
||||
todo_wine ok(next_time == 200, "got next_time %lu\n", next_time);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(next_time == 200, "got next_time %lu\n", next_time);
|
||||
ok(param.mtTime == 0, "got mtTime %ld\n", param.mtTime);
|
||||
todo_wine ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
hr = IDirectMusicSegment_GetParam(segment, &GUID_TempoParam, -1, DMUS_SEG_ALLTRACKS, 199, &next_time, ¶m);
|
||||
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
|
||||
todo_wine ok(next_time == 101, "got next_time %lu\n", next_time);
|
||||
todo_wine ok(param.mtTime == -99, "got mtTime %ld\n", param.mtTime);
|
||||
todo_wine ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(next_time == 101, "got next_time %lu\n", next_time);
|
||||
ok(param.mtTime == -99, "got mtTime %ld\n", param.mtTime);
|
||||
ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
hr = IDirectMusicSegment_GetParam(segment, &GUID_TempoParam, -1, DMUS_SEG_ALLTRACKS, 200, &next_time, ¶m);
|
||||
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
|
||||
todo_wine ok(next_time == 100, "got next_time %lu\n", next_time);
|
||||
todo_wine ok(param.mtTime == -100, "got mtTime %ld\n", param.mtTime);
|
||||
todo_wine ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(next_time == 100, "got next_time %lu\n", next_time);
|
||||
ok(param.mtTime == -100, "got mtTime %ld\n", param.mtTime);
|
||||
ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
hr = IDirectMusicSegment_GetParam(segment, &GUID_TempoParam, -1, DMUS_SEG_ALLTRACKS, 299, &next_time, ¶m);
|
||||
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
|
||||
todo_wine ok(next_time == 1, "got next_time %lu\n", next_time);
|
||||
todo_wine ok(param.mtTime == -199, "got mtTime %ld\n", param.mtTime);
|
||||
todo_wine ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(next_time == 1, "got next_time %lu\n", next_time);
|
||||
ok(param.mtTime == -199, "got mtTime %ld\n", param.mtTime);
|
||||
ok(param.dblTempo == 80, "got dblTempo %f\n", param.dblTempo);
|
||||
hr = IDirectMusicSegment_GetParam(segment, &GUID_TempoParam, -1, DMUS_SEG_ALLTRACKS, 300, &next_time, ¶m);
|
||||
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
|
||||
todo_wine ok(next_time == 3700, "got next_time %lu\n", next_time);
|
||||
todo_wine ok(param.mtTime == -100, "got mtTime %ld\n", param.mtTime);
|
||||
todo_wine ok(param.dblTempo == 20, "got dblTempo %f\n", param.dblTempo);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(next_time == 3700, "got next_time %lu\n", next_time);
|
||||
ok(param.mtTime == -100, "got mtTime %ld\n", param.mtTime);
|
||||
ok(param.dblTempo == 20, "got dblTempo %f\n", param.dblTempo);
|
||||
hr = IDirectMusicSegment_GetParam(segment, &GUID_TempoParam, -1, DMUS_SEG_ALLTRACKS, 5000, &next_time, ¶m);
|
||||
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(hr == S_OK, "got %#lx\n", hr);
|
||||
ok(next_time == 0, "got next_time %lu\n", next_time);
|
||||
todo_wine ok(param.mtTime == -1000, "got mtTime %ld\n", param.mtTime);
|
||||
todo_wine ok(param.dblTempo == 50, "got dblTempo %f\n", param.dblTempo);
|
||||
ok(param.mtTime == -1000, "got mtTime %ld\n", param.mtTime);
|
||||
ok(param.dblTempo == 50, "got dblTempo %f\n", param.dblTempo);
|
||||
|
||||
|
||||
/* now play the segment, and check produced messages */
|
||||
|
|
Loading…
Reference in a new issue