aboutsummaryrefslogtreecommitdiff
path: root/src/decoder/fluidsynth_decoder_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-15 00:47:10 +0200
committerMax Kellermann <max@duempel.org>2012-08-15 00:47:10 +0200
commitb1bbd70f0f956e9829158ee80a42f1bafde67347 (patch)
tree6edf07b31915413ad8c38596a94759c52faedd0c /src/decoder/fluidsynth_decoder_plugin.c
parentc31d11bfe07a6c37d53061dd0ef732d602f98154 (diff)
decoder/fluidsynth: stop playback at end of file
Use libfluidsynth's new function fluid_player_get_status().
Diffstat (limited to 'src/decoder/fluidsynth_decoder_plugin.c')
-rw-r--r--src/decoder/fluidsynth_decoder_plugin.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/decoder/fluidsynth_decoder_plugin.c b/src/decoder/fluidsynth_decoder_plugin.c
index b55c1db5..a8c148c8 100644
--- a/src/decoder/fluidsynth_decoder_plugin.c
+++ b/src/decoder/fluidsynth_decoder_plugin.c
@@ -168,7 +168,7 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
decoder_initialized(decoder, &audio_format, false, -1);
- do {
+ while (fluid_player_get_status(player) == FLUID_PLAYER_PLAYING) {
int16_t buffer[2048];
const unsigned max_frames = G_N_ELEMENTS(buffer) / 2;
@@ -178,15 +178,14 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
ret = fluid_synth_write_s16(synth, max_frames,
buffer, 0, 2,
buffer, 1, 2);
- /* XXX how do we see whether the player is done? We
- can't access the private attribute
- player->status */
if (ret != 0)
break;
cmd = decoder_data(decoder, NULL, buffer, sizeof(buffer),
0);
- } while (cmd == DECODE_COMMAND_NONE);
+ if (cmd != DECODE_COMMAND_NONE)
+ break;
+ }
/* clean up */