diff --git a/src/midi/fluid_midi.c b/src/midi/fluid_midi.c index c8ad9d2c5..5df704a20 100644 --- a/src/midi/fluid_midi.c +++ b/src/midi/fluid_midi.c @@ -1641,6 +1641,23 @@ fluid_player_handle_reset_synth(void *data, const char *name, int value) player->reset_synth_between_songs = value; } +static int check_for_on_notes(fluid_synth_t *synth) +{ + fluid_voice_t* v[1024]; + int i, res=FALSE; + fluid_synth_get_voicelist(synth, v, FLUID_N_ELEMENTS(v), -1); + for(i=0; iend_pedals_disabled) { + if(check_for_on_notes(synth)) + { + FLUID_LOG(FLUID_WARN, "End of the MIDI file reached, but not all notes have received a note off event! OFFing them now! Run with --verbose to spot pending voices."); + } + for(i = 0; i < synth->midi_channels; i++) { fluid_synth_cc(player->synth, i, SUSTAIN_SWITCH, 0); fluid_synth_cc(player->synth, i, SOSTENUTO_SWITCH, 0); + fluid_synth_cc(player->synth, i, ALL_NOTES_OFF, 0); } player->end_pedals_disabled = 1;