diff --git a/src/fluidsynth.c b/src/fluidsynth.c index 33e6267d..ec905023 100644 --- a/src/fluidsynth.c +++ b/src/fluidsynth.c @@ -609,15 +609,6 @@ int main(int argc, char** argv) } } - - /* start the midi router and link it to the synth */ -#if WITH_MIDI - if (midi_in) { - /* In dump mode, text output is generated for events going into and out of the router. - * The example dump functions are put into the chain before and after the router.. - */ - //sequencer = new_fluid_sequencer2(0); - router = new_fluid_midi_router( settings, dump ? fluid_midi_dump_postrouter : fluid_synth_handle_midi_event, @@ -627,7 +618,15 @@ int main(int argc, char** argv) fprintf(stderr, "Failed to create the MIDI input router; no MIDI input\n" "will be available. You can access the synthesizer \n" "through the console.\n"); - } else { + } + + /* start the midi router and link it to the synth */ +#if WITH_MIDI + if (midi_in && router != NULL) { + /* In dump mode, text output is generated for events going into and out of the router. + * The example dump functions are put into the chain before and after the router.. + */ + //sequencer = new_fluid_sequencer2(0); mdriver = new_fluid_midi_driver( settings, dump ? fluid_midi_dump_prerouter : fluid_midi_router_handle_midi_event, @@ -638,7 +637,6 @@ int main(int argc, char** argv) "through the console.\n"); } } - } #endif /* play the midi files, if any */ @@ -652,6 +650,10 @@ int main(int argc, char** argv) "Continuing without a player.\n"); break; } + if (router != NULL) + { + fluid_player_set_playback_callback(player, fluid_midi_router_handle_midi_event, router); + } } fluid_player_add(player, argv[i]);