Skip to content

Command Handler

Handles text commands and reading of configuration files.

Lifecycle Functions for Command Handler

new_fluid_cmd_handler()

fluid_cmd_handler_t * new_fluid_cmd_handler(fluid_synth_t *synth, fluid_midi_router_t *router)

Create a new command handler.

See also: See new_fluid_cmd_handler2() for more information.

Parameters:

Name Description
synth If not NULL, all the default synthesizer commands will be added to the new handler.
router If not NULL, all the default midi_router commands will be added to the new handler.

Returns: New command handler, or NULL if alloc failed

new_fluid_cmd_handler2()

fluid_cmd_handler_t * new_fluid_cmd_handler2(fluid_settings_t *settings, fluid_synth_t *synth, fluid_midi_router_t *router, fluid_player_t *player)

Create a new command handler.

Parameters:

Name Description
settings If not NULL, all the settings related commands will be added to the new handler. The settings object must be the same as the one you used for creating the synth and router. Otherwise the behaviour is undefined.
synth If not NULL, all the default synthesizer commands will be added to the new handler.
router If not NULL, all the default midi_router commands will be added to the new handler.
player If not NULL, all the default midi file player commands will be added to the new handler.

Returns: New command handler, or NULL if alloc failed

delete_fluid_cmd_handler()

void delete_fluid_cmd_handler(fluid_cmd_handler_t *handler)

Delete a command handler.

Parameters:

Name Description
handler Command handler to delete

Functions

fluid_cmd_handler_set_synth()

void fluid_cmd_handler_set_synth(fluid_cmd_handler_t *handler, fluid_synth_t *synth)

fluid_command()

int fluid_command(fluid_cmd_handler_t *handler, const char *cmd, fluid_ostream_t out)

Process a string command.

Parameters:

Name Description
handler FluidSynth command handler
cmd Command string (NOTE: Gets modified by FluidSynth prior to 1.0.8)
out Output stream to display command response to

Returns: Integer value corresponding to: -1 on command error, 0 on success, 1 if 'cmd' is a comment or is empty and -2 if quit was issued

Note

FluidSynth 1.0.8 and above no longer modifies the 'cmd' string.

fluid_source()

int fluid_source(fluid_cmd_handler_t *handler, const char *filename)

Execute shell commands in a file.

Parameters:

Name Description
handler Command handler callback
filename File name

Returns: 0 on success, a negative value on error