libfluidsynth  2.0.2
Functions
shell.h File Reference

Command shell interface. More...

Functions

FLUIDSYNTH_API fluid_istream_t fluid_get_stdin (void)
 Get standard in stream handle. More...
 
FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout (void)
 Get standard output stream handle. More...
 
FLUIDSYNTH_API char * fluid_get_userconf (char *buf, int len)
 Get the user specific FluidSynth command file name. More...
 
FLUIDSYNTH_API char * fluid_get_sysconf (char *buf, int len)
 Get the system FluidSynth command file name. More...
 
FLUIDSYNTH_API fluid_cmd_handler_tnew_fluid_cmd_handler (fluid_synth_t *synth, fluid_midi_router_t *router)
 Create a new command handler. More...
 
FLUIDSYNTH_API void delete_fluid_cmd_handler (fluid_cmd_handler_t *handler)
 Delete a command handler. More...
 
FLUIDSYNTH_API int fluid_command (fluid_cmd_handler_t *handler, const char *cmd, fluid_ostream_t out)
 Process a string command. More...
 
FLUIDSYNTH_API int fluid_source (fluid_cmd_handler_t *handler, const char *filename)
 Execute shell commands in a file. More...
 
FLUIDSYNTH_API void fluid_usershell (fluid_settings_t *settings, fluid_cmd_handler_t *handler)
 A convenience function to create a shell interfacing to standard input/output console streams. More...
 
FLUIDSYNTH_API fluid_shell_tnew_fluid_shell (fluid_settings_t *settings, fluid_cmd_handler_t *handler, fluid_istream_t in, fluid_ostream_t out, int thread)
 Create a new FluidSynth command shell. More...
 
FLUIDSYNTH_API void delete_fluid_shell (fluid_shell_t *shell)
 Delete a FluidSynth command shell. More...
 
FLUIDSYNTH_API fluid_server_tnew_fluid_server (fluid_settings_t *settings, fluid_synth_t *synth, fluid_midi_router_t *router)
 Create a new TCP/IP command shell server. More...
 
FLUIDSYNTH_API void delete_fluid_server (fluid_server_t *server)
 Delete a TCP/IP shell server. More...
 
FLUIDSYNTH_API int fluid_server_join (fluid_server_t *server)
 Join a shell server thread (wait until it quits). More...
 

Detailed Description

Command shell interface.

The shell interface allows you to send simple textual commands to the synthesizer, to parse a command file, or to read commands from the stdin or other input streams.

Function Documentation

◆ fluid_get_stdin()

FLUIDSYNTH_API fluid_istream_t fluid_get_stdin ( void  )

Get standard in stream handle.

Returns
Standard in stream.

Referenced by fluid_get_stdout(), and fluid_usershell().

◆ fluid_get_stdout()

FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout ( void  )

Get standard output stream handle.

Returns
Standard out stream.

References FLUID_DBG, FLUID_ERR, FLUID_FAILED, fluid_get_stdin(), and FLUID_OK.

Referenced by fluid_source(), and fluid_usershell().

◆ fluid_get_userconf()

FLUIDSYNTH_API char* fluid_get_userconf ( char *  buf,
int  len 
)

Get the user specific FluidSynth command file name.

Parameters
bufCaller supplied string buffer to store file name to.
lenLength of buf
Returns
Returns buf pointer or NULL if no user command file for this system type.

◆ fluid_get_sysconf()

FLUIDSYNTH_API char* fluid_get_sysconf ( char *  buf,
int  len 
)

Get the system FluidSynth command file name.

Parameters
bufCaller supplied string buffer to store file name to.
lenLength of buf
Returns
Returns buf pointer or NULL if no system command file for this system type.

References delete_fluid_midi_router_rule(), FLUID_CHANNEL_MODE_MASK, FLUID_FAILED, FLUID_HINT_TOGGLED, FLUID_INT_TYPE, FLUID_INTERP_HIGHEST, fluid_midi_router_add_rule(), fluid_midi_router_clear_rules(), FLUID_MIDI_ROUTER_RULE_CC, FLUID_MIDI_ROUTER_RULE_CHANNEL_PRESSURE, FLUID_MIDI_ROUTER_RULE_KEY_PRESSURE, FLUID_MIDI_ROUTER_RULE_NOTE, FLUID_MIDI_ROUTER_RULE_PITCH_BEND, FLUID_MIDI_ROUTER_RULE_PROG_CHANGE, fluid_midi_router_rule_set_chan(), fluid_midi_router_rule_set_param1(), fluid_midi_router_rule_set_param2(), fluid_midi_router_set_default_rules(), FLUID_NO_TYPE, FLUID_NUM_TYPE, FLUID_OK, fluid_preset_get_banknum(), fluid_preset_get_name(), fluid_preset_get_num(), FLUID_SET_TYPE, fluid_settings_dupstr(), fluid_settings_foreach(), fluid_settings_foreach_option(), fluid_settings_get_hints(), fluid_settings_get_type(), fluid_settings_getint(), fluid_settings_getint_default(), fluid_settings_getint_range(), fluid_settings_getnum(), fluid_settings_getnum_default(), fluid_settings_getnum_range(), fluid_settings_getstr_default(), fluid_settings_is_realtime(), fluid_settings_setint(), fluid_settings_setnum(), fluid_settings_setstr(), fluid_sfont_get_id(), fluid_sfont_get_name(), fluid_sfont_iteration_next(), fluid_sfont_iteration_start(), fluid_source(), FLUID_STR_TYPE, fluid_synth_activate_key_tuning(), fluid_synth_activate_tuning(), fluid_synth_bank_select(), fluid_synth_cc(), fluid_synth_count_midi_channels(), fluid_synth_deactivate_tuning(), fluid_synth_get_active_voice_count(), fluid_synth_get_bank_offset(), fluid_synth_get_basic_channel(), fluid_synth_get_channel_preset(), fluid_synth_get_settings(), fluid_synth_get_sfont(), fluid_synth_get_sfont_by_id(), fluid_synth_noteoff(), fluid_synth_noteon(), fluid_synth_pitch_bend(), fluid_synth_program_change(), fluid_synth_program_reset(), fluid_synth_program_select(), fluid_synth_set_bank_offset(), fluid_synth_set_chorus_depth(), fluid_synth_set_chorus_level(), fluid_synth_set_chorus_nr(), fluid_synth_set_chorus_on(), fluid_synth_set_chorus_speed(), fluid_synth_set_gain(), fluid_synth_set_interp_method(), fluid_synth_set_reverb_damp(), fluid_synth_set_reverb_level(), fluid_synth_set_reverb_on(), fluid_synth_set_reverb_roomsize(), fluid_synth_set_reverb_width(), fluid_synth_sfcount(), fluid_synth_sfload(), fluid_synth_sfreload(), fluid_synth_sfunload(), fluid_synth_system_reset(), fluid_synth_tune_notes(), fluid_synth_tuning_dump(), fluid_synth_tuning_iteration_next(), fluid_synth_tuning_iteration_start(), and new_fluid_midi_router_rule().

◆ new_fluid_cmd_handler()

FLUIDSYNTH_API fluid_cmd_handler_t* new_fluid_cmd_handler ( fluid_synth_t synth,
fluid_midi_router_t router 
)

Create a new command handler.

Parameters
synthIf not NULL, all the default synthesizer commands will be added to the new handler.
routerIf not NULL, all the default midi_router commands will be added to the new handler.
Returns
New command handler, or NULL if alloc failed

Referenced by delete_fluid_cmd_handler().

◆ delete_fluid_cmd_handler()

FLUIDSYNTH_API void delete_fluid_cmd_handler ( fluid_cmd_handler_t handler)

Delete a command handler.

Parameters
handlerCommand handler to delete

References FLUID_DBG, FLUID_ERR, FLUID_FAILED, FLUID_OK, and new_fluid_cmd_handler().

◆ fluid_command()

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

Process a string command.

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

Parameters
handlerFluidSynth command handler
cmdCommand string (NOTE: Gets modified by FluidSynth prior to 1.0.8)
outOutput 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

References FLUID_FAILED.

Referenced by delete_fluid_shell().

◆ fluid_source()

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

Execute shell commands in a file.

Parameters
handlerCommand handler callback
filenameFile name
Returns
0 on success, a negative value on error

References fluid_get_stdout().

Referenced by fluid_get_sysconf().

◆ fluid_usershell()

FLUIDSYNTH_API void fluid_usershell ( fluid_settings_t settings,
fluid_cmd_handler_t handler 
)

A convenience function to create a shell interfacing to standard input/output console streams.

Parameters
settingsSettings instance for the shell
handlerCommand handler callback

References fluid_get_stdin(), and fluid_get_stdout().

◆ new_fluid_shell()

FLUIDSYNTH_API fluid_shell_t* new_fluid_shell ( fluid_settings_t settings,
fluid_cmd_handler_t handler,
fluid_istream_t  in,
fluid_ostream_t  out,
int  thread 
)

Create a new FluidSynth command shell.

Parameters
settingsSetting parameters to use with the shell
handlerCommand handler
inInput stream
outOutput stream
threadTRUE if shell should be run in a separate thread, FALSE to run it in the current thread (function blocks until "quit")
Returns
New shell instance or NULL on error

References delete_fluid_shell(), and FLUID_PANIC.

◆ delete_fluid_shell()

FLUIDSYNTH_API void delete_fluid_shell ( fluid_shell_t shell)

Delete a FluidSynth command shell.

Parameters
shellCommand shell instance

References fluid_command(), FLUID_FAILED, FLUID_OK, and fluid_settings_dupstr().

Referenced by new_fluid_shell().

◆ new_fluid_server()

FLUIDSYNTH_API fluid_server_t* new_fluid_server ( fluid_settings_t settings,
fluid_synth_t synth,
fluid_midi_router_t router 
)

Create a new TCP/IP command shell server.

Parameters
settingsSettings instance to use for the shell
synthIf not NULL, the synth instance for the command handler to be used by the client
routerIf not NULL, the midi_router instance for the command handler to be used by the client
Returns
New shell server instance or NULL on error

References FLUID_ERR, fluid_settings_getint(), and FLUID_WARN.

◆ delete_fluid_server()

FLUIDSYNTH_API void delete_fluid_server ( fluid_server_t server)

Delete a TCP/IP shell server.

Parameters
serverShell server instance

◆ fluid_server_join()

FLUIDSYNTH_API int fluid_server_join ( fluid_server_t server)

Join a shell server thread (wait until it quits).

Parameters
serverShell server instance
Returns
FLUID_OK on success, FLUID_FAILED otherwise

References FLUID_FAILED.