diff options
author | Simon Howard | 2014-05-11 00:14:04 -0400 |
---|---|---|
committer | Simon Howard | 2014-05-11 00:14:04 -0400 |
commit | 72ce4242077f23b7de876b977397856bd072a6b1 (patch) | |
tree | 1002b8eb4f15d16564a1acadfcd04a264cde558d /opl/opl_queue.c | |
parent | 495694da29ff736fba2fdc696553ee7197247174 (diff) | |
download | chocolate-doom-72ce4242077f23b7de876b977397856bd072a6b1.tar.gz chocolate-doom-72ce4242077f23b7de876b977397856bd072a6b1.tar.bz2 chocolate-doom-72ce4242077f23b7de876b977397856bd072a6b1.zip |
opl: Change library to use us instead of ms.
Multi-track MIDI files are played back using separate callback chains
for each track, and this introduces the possibility of one track
becoming out of sync with the others. This was noticeable in WADs
that use multi-track MIDIs, such as Alien Vendetta. Increase the
timing resolution to microsecond precision to fix this.
Diffstat (limited to 'opl/opl_queue.c')
-rw-r--r-- | opl/opl_queue.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/opl/opl_queue.c b/opl/opl_queue.c index ee87a19b..4b4e4e38 100644 --- a/opl/opl_queue.c +++ b/opl/opl_queue.c @@ -28,7 +28,7 @@ typedef struct { opl_callback_t callback; void *data; - unsigned int time; + uint64_t time; } opl_queue_entry_t; struct opl_callback_queue_s @@ -64,7 +64,7 @@ void OPL_Queue_Clear(opl_callback_queue_t *queue) void OPL_Queue_Push(opl_callback_queue_t *queue, opl_callback_t callback, void *data, - unsigned int time) + uint64_t time) { int entry_id; int parent_id; @@ -189,7 +189,7 @@ int OPL_Queue_Pop(opl_callback_queue_t *queue, return 1; } -unsigned int OPL_Queue_Peek(opl_callback_queue_t *queue) +uint64_t OPL_Queue_Peek(opl_callback_queue_t *queue) { if (queue->num_entries > 0) { @@ -202,15 +202,15 @@ unsigned int OPL_Queue_Peek(opl_callback_queue_t *queue) } void OPL_Queue_AdjustCallbacks(opl_callback_queue_t *queue, - unsigned int time, float factor) + uint64_t time, float factor) { - int offset; + int64_t offset; int i; for (i = 0; i < queue->num_entries; ++i) { offset = queue->entries[i].time - time; - queue->entries[i].time = time + (int) (offset * factor); + queue->entries[i].time = time + (uint64_t) (offset * factor); } } |