diff options
Diffstat (limited to 'src/music/fluidsynth.cpp')
-rw-r--r-- | src/music/fluidsynth.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/music/fluidsynth.cpp b/src/music/fluidsynth.cpp index 061ade345..1c4b67e12 100644 --- a/src/music/fluidsynth.cpp +++ b/src/music/fluidsynth.cpp @@ -163,21 +163,12 @@ void MusicDriver_FluidSynth::PlaySong(const MusicSongInfo &song) void MusicDriver_FluidSynth::StopSong() { - { - std::lock_guard<std::mutex> lock{ _midi.synth_mutex }; - - if (_midi.player == nullptr) return; - - fluid_player_stop(_midi.player); - } + std::lock_guard<std::mutex> lock{ _midi.synth_mutex }; - /* The join must be run without lock as the Music rendering needs to be - * running so FluidSynth's internals can actually stop the playing. */ - if (fluid_player_join(_midi.player) != FLUID_OK) { - DEBUG(driver, 0, "Could not join player"); - } + if (_midi.player == nullptr) return; - std::lock_guard<std::mutex> lock{ _midi.synth_mutex }; + fluid_player_stop(_midi.player); + /* No fluid_player_join needed */ delete_fluid_player(_midi.player); fluid_synth_system_reset(_midi.synth); fluid_synth_all_sounds_off(_midi.synth, -1); |