aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-12 18:19:13 +0100
committerMax Kellermann <max@duempel.org>2009-02-12 18:19:13 +0100
commita2ce6e5b823f5af7ac08380b4acb145713a80c11 (patch)
tree03abf3aee0462d25a26d2f4a6904330e22517a3f /src/decoder
parentf6c8dd49617b411a25c095710e43ba3b4725f55c (diff)
downloadmpd-a2ce6e5b823f5af7ac08380b4acb145713a80c11.tar.gz
mpd-a2ce6e5b823f5af7ac08380b4acb145713a80c11.tar.xz
mpd-a2ce6e5b823f5af7ac08380b4acb145713a80c11.zip
wildmidi: added seeking support
Use WildMidi_SampledSeek() for seeking in a MIDI file.
Diffstat (limited to '')
-rw-r--r--src/decoder/wildmidi_plugin.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/decoder/wildmidi_plugin.c b/src/decoder/wildmidi_plugin.c
index 39b82d0b1..a045a6b1f 100644
--- a/src/decoder/wildmidi_plugin.c
+++ b/src/decoder/wildmidi_plugin.c
@@ -67,7 +67,7 @@ wildmidi_file_decode(struct decoder *decoder, const char *path_fs)
return;
}
- decoder_initialized(decoder, &audio_format, false,
+ decoder_initialized(decoder, &audio_format, true,
info->approx_total_samples / WILDMIDI_SAMPLE_RATE);
do {
@@ -86,6 +86,16 @@ wildmidi_file_decode(struct decoder *decoder, const char *path_fs)
(float)info->current_sample /
(float)WILDMIDI_SAMPLE_RATE,
0, NULL);
+
+ if (cmd == DECODE_COMMAND_SEEK) {
+ unsigned long seek_where = WILDMIDI_SAMPLE_RATE *
+ decoder_seek_where(decoder);
+
+ WildMidi_SampledSeek(wm, &seek_where);
+ decoder_command_finished(decoder);
+ cmd = DECODE_COMMAND_NONE;
+ }
+
} while (cmd == DECODE_COMMAND_NONE);
WildMidi_Close(wm);