libfluidsynth
1.1.11
|
Command shell interface. More...
Data Structures | |
struct | fluid_cmd_t |
Shell command information structure. More... | |
Typedefs | |
typedef int(* | fluid_cmd_func_t) (void *data, int ac, char **av, fluid_ostream_t out) |
Command handler function prototype. More... | |
typedef fluid_cmd_handler_t *(* | fluid_server_newclient_func_t) (void *data, char *addr) |
Callback function which is executed for new server connections. 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_t * | new_fluid_cmd_handler (fluid_synth_t *synth) |
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_cmd_handler_register (fluid_cmd_handler_t *handler, fluid_cmd_t *cmd) |
Register a new command to the handler. More... | |
FLUIDSYNTH_API int | fluid_cmd_handler_unregister (fluid_cmd_handler_t *handler, const char *cmd) |
Unregister a command from 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_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. More... | |
FLUIDSYNTH_API void | delete_fluid_shell (fluid_shell_t *shell) |
Delete a FluidSynth command shell. More... | |
FLUIDSYNTH_API fluid_server_t * | new_fluid_server (fluid_settings_t *settings, fluid_server_newclient_func_t func, void *data) |
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... | |
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.
typedef int(* fluid_cmd_func_t) (void *data, int ac, char **av, fluid_ostream_t out) |
Command handler function prototype.
data | User defined data |
ac | Argument count |
av | Array of string arguments |
out | Output stream to send response to |
typedef fluid_cmd_handler_t*(* fluid_server_newclient_func_t) (void *data, char *addr) |
Callback function which is executed for new server connections.
data | User defined data supplied in call to new_fluid_server() |
addr | The IP address of the client (can be NULL) |
FLUIDSYNTH_API fluid_istream_t fluid_get_stdin | ( | void | ) |
Get standard in stream handle.
Referenced by delete_fluid_shell(), fluid_get_stdout(), and fluid_usershell().
FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout | ( | void | ) |
Get standard output stream handle.
References FLUID_DBG, FLUID_ERR, fluid_get_stdin(), and FLUID_OK.
Referenced by fluid_source(), and fluid_usershell().
FLUIDSYNTH_API char* fluid_get_userconf | ( | char * | buf, |
int | len | ||
) |
Get the user specific FluidSynth command file name.
buf | Caller supplied string buffer to store file name to. |
len | Length of buf |
FLUIDSYNTH_API char* fluid_get_sysconf | ( | char * | buf, |
int | len | ||
) |
Get the system FluidSynth command file name.
buf | Caller supplied string buffer to store file name to. |
len | Length of buf |
References _fluid_synth_channel_info_t::assigned, _fluid_synth_channel_info_t::bank, FLUID_FAILED, FLUID_OK, fluid_synth_bank_select(), fluid_synth_cc(), fluid_synth_count_midi_channels(), fluid_synth_get_bank_offset(), fluid_synth_get_channel_info(), 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_sfcount(), fluid_synth_sfload(), fluid_synth_sfreload(), fluid_synth_sfunload(), _fluid_synth_channel_info_t::name, _fluid_synth_channel_info_t::program, and _fluid_synth_channel_info_t::sfont_id.
FLUIDSYNTH_API fluid_cmd_handler_t* new_fluid_cmd_handler | ( | fluid_synth_t * | synth | ) |
Create a new command handler.
synth | If not NULL, all the default synthesizer commands will be added to the new handler. |
References fluid_cmd_t::data, fluid_cmd_handler_register(), and fluid_cmd_t::name.
FLUIDSYNTH_API void delete_fluid_cmd_handler | ( | fluid_cmd_handler_t * | handler | ) |
Delete a command handler.
handler | Command handler to delete |
FLUIDSYNTH_API int fluid_cmd_handler_register | ( | fluid_cmd_handler_t * | handler, |
fluid_cmd_t * | cmd | ||
) |
Register a new command to the handler.
handler | Command handler instance |
cmd | Command info (gets copied) |
References FLUID_OK, and fluid_cmd_t::name.
Referenced by new_fluid_cmd_handler().
FLUIDSYNTH_API int fluid_cmd_handler_unregister | ( | fluid_cmd_handler_t * | handler, |
const char * | cmd | ||
) |
Unregister a command from a command handler.
handler | Command handler instance |
cmd | Name of the command |
References fluid_cmd_t::data, and fluid_cmd_t::handler.
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.
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 |
Referenced by delete_fluid_shell().
FLUIDSYNTH_API int fluid_source | ( | fluid_cmd_handler_t * | handler, |
const char * | filename | ||
) |
Execute shell commands in a file.
handler | Command handler callback |
filename | File name |
References fluid_get_stdout().
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.
settings | Settings instance for the shell |
handler | Command handler callback |
References fluid_get_stdin(), and fluid_get_stdout().
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.
settings | Setting parameters to use with the shell |
handler | Command handler |
in | Input stream |
out | Output stream |
thread | TRUE if shell should be run in a separate thread, FALSE to run it in the current thread (function blocks until "quit") |
References delete_fluid_shell(), and FLUID_PANIC.
FLUIDSYNTH_API void delete_fluid_shell | ( | fluid_shell_t * | shell | ) |
Delete a FluidSynth command shell.
shell | Command shell instance |
References fluid_command(), fluid_get_stdin(), and fluid_settings_dupstr().
Referenced by new_fluid_shell().
FLUIDSYNTH_API fluid_server_t* new_fluid_server | ( | fluid_settings_t * | settings, |
fluid_server_newclient_func_t | newclient, | ||
void * | data | ||
) |
Create a new TCP/IP command shell server.
settings | Settings instance to use for the shell |
newclient | Callback function to call for each new client connection |
data | User defined data to pass to newclient callback |
References FLUID_ERR, and fluid_settings_getint().
FLUIDSYNTH_API void delete_fluid_server | ( | fluid_server_t * | server | ) |
Delete a TCP/IP shell server.
server | Shell server instance |
FLUIDSYNTH_API int fluid_server_join | ( | fluid_server_t * | server | ) |
Join a shell server thread (wait until it quits).
server | Shell server instance |