Commit 88c7e935 authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

dmsynth: Use time instead of position to order events.

Different time values can map to the same position.
parent 2c08013b
...@@ -322,6 +322,7 @@ struct preset ...@@ -322,6 +322,7 @@ struct preset
struct event struct event
{ {
struct list entry; struct list entry;
REFERENCE_TIME time;
LONGLONG position; LONGLONG position;
BYTE midi[3]; BYTE midi[3];
}; };
...@@ -973,11 +974,12 @@ static HRESULT WINAPI synth_PlayBuffer(IDirectMusicSynth8 *iface, ...@@ -973,11 +974,12 @@ static HRESULT WINAPI synth_PlayBuffer(IDirectMusicSynth8 *iface,
{ {
if (!(event = calloc(1, sizeof(*event)))) return E_OUTOFMEMORY; if (!(event = calloc(1, sizeof(*event)))) return E_OUTOFMEMORY;
memcpy(event->midi, data, head->cbEvent); memcpy(event->midi, data, head->cbEvent);
event->time = time + head->rtDelta;
event->position = position; event->position = position;
EnterCriticalSection(&This->cs); EnterCriticalSection(&This->cs);
LIST_FOR_EACH_ENTRY(next_event, &This->events, struct event, entry) LIST_FOR_EACH_ENTRY(next_event, &This->events, struct event, entry)
if (next_event->position > event->position) break; if (next_event->time > event->time) break;
list_add_before(&next_event->entry, &event->entry); list_add_before(&next_event->entry, &event->entry);
LeaveCriticalSection(&This->cs); LeaveCriticalSection(&This->cs);
} }
......
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