From 8413c35aca641567baf13e9b16e9839019ebf99d Mon Sep 17 00:00:00 2001 From: Tom M Date: Sat, 27 Mar 2021 18:35:00 +0100 Subject: [PATCH] Fix a regression in fluid_player_stop() (#822) fluid_player_stop() should not set the STOPPING state, when the player has already finished. Introduced in 676923757c4f96c5c34931da5566d5b5be3e15eb. --- src/midi/fluid_midi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/midi/fluid_midi.c b/src/midi/fluid_midi.c index 86166d8f..796b278f 100644 --- a/src/midi/fluid_midi.c +++ b/src/midi/fluid_midi.c @@ -2195,7 +2195,8 @@ fluid_player_play(fluid_player_t *player) int fluid_player_stop(fluid_player_t *player) { - fluid_atomic_int_set(&player->status, FLUID_PLAYER_STOPPING); + fluid_atomic_int_compare_and_exchange(&player->status, FLUID_PLAYER_READY, FLUID_PLAYER_STOPPING); + fluid_atomic_int_compare_and_exchange(&player->status, FLUID_PLAYER_PLAYING, FLUID_PLAYER_STOPPING); fluid_player_seek(player, fluid_player_get_current_tick(player)); return FLUID_OK; }