mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-26 22:21:31 +00:00
implement new_fluid_cmd_handler() according to documentation
by only registering commands requested by the user
This commit is contained in:
parent
183a69a51f
commit
a1bc872754
1 changed files with 9 additions and 2 deletions
|
@ -3548,12 +3548,19 @@ fluid_cmd_handler_t* new_fluid_cmd_handler(fluid_synth_t* synth, fluid_midi_rout
|
|||
handler->synth = synth;
|
||||
handler->router = router;
|
||||
|
||||
if (synth != NULL) {
|
||||
for (i = 0; i < FLUID_N_ELEMENTS(fluid_commands); i++)
|
||||
{
|
||||
fluid_cmd_t* cmd = &fluid_commands[i];
|
||||
int is_router_cmd = FLUID_STRCMP(cmd->topic, "router") == 0;
|
||||
|
||||
if((is_router_cmd && router == NULL) || (!is_router_cmd && synth == NULL))
|
||||
{
|
||||
/* omit registering router and synth commands if they were not requested */
|
||||
continue;
|
||||
}
|
||||
|
||||
fluid_cmd_handler_register(handler, &fluid_commands[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue