allow manipulating midi files using midi_router

This commit is contained in:
derselbst 2018-06-11 17:50:35 +02:00
parent b3cb079b60
commit 5c83c9748b

View file

@ -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( router = new_fluid_midi_router(
settings, settings,
dump ? fluid_midi_dump_postrouter : fluid_synth_handle_midi_event, 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" fprintf(stderr, "Failed to create the MIDI input router; no MIDI input\n"
"will be available. You can access the synthesizer \n" "will be available. You can access the synthesizer \n"
"through the console.\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( mdriver = new_fluid_midi_driver(
settings, settings,
dump ? fluid_midi_dump_prerouter : fluid_midi_router_handle_midi_event, 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"); "through the console.\n");
} }
} }
}
#endif #endif
/* play the midi files, if any */ /* play the midi files, if any */
@ -652,6 +650,10 @@ int main(int argc, char** argv)
"Continuing without a player.\n"); "Continuing without a player.\n");
break; break;
} }
if (router != NULL)
{
fluid_player_set_playback_callback(player, fluid_midi_router_handle_midi_event, router);
}
} }
fluid_player_add(player, argv[i]); fluid_player_add(player, argv[i]);