diff --git a/src/decoder_fluidsynth.cpp b/src/decoder_fluidsynth.cpp index f171ff7d2f..5b048feb04 100644 --- a/src/decoder_fluidsynth.cpp +++ b/src/decoder_fluidsynth.cpp @@ -214,7 +214,12 @@ FluidSynthDecoder::~FluidSynthDecoder() { --instances; assert(instances >= 0); - if (!use_global_synth) { + if (use_global_synth) { + // Exhaust the internal synth buffer + // Prevents that old samples play when a new Midi song starts (even when there was a longer break between them) + std::array buffer; + fluid_synth_write_s16(global_synth.get(), buffer.size() / 4, buffer.data(), 0, 2, buffer.data(), 1, 2); + } else { delete_fluid_synth(local_synth); } }