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. | |
typedef fluid_cmd_handler_t *(* | fluid_server_newclient_func_t )(void *data, char *addr) |
Callback function which is executed for new server connections. | |
Functions | |
FLUIDSYNTH_API fluid_istream_t | fluid_get_stdin (void) |
Get standard in stream handle. | |
FLUIDSYNTH_API fluid_ostream_t | fluid_get_stdout (void) |
Get standard output stream handle. | |
FLUIDSYNTH_API char * | fluid_get_userconf (char *buf, int len) |
Get the user specific FluidSynth command file name. | |
FLUIDSYNTH_API char * | fluid_get_sysconf (char *buf, int len) |
Get the system FluidSynth command file name. | |
FLUIDSYNTH_API fluid_cmd_handler_t * | new_fluid_cmd_handler (fluid_synth_t *synth) |
Create a new command handler. | |
FLUIDSYNTH_API void | delete_fluid_cmd_handler (fluid_cmd_handler_t *handler) |
Delete a command handler. | |
FLUIDSYNTH_API int | fluid_cmd_handler_register (fluid_cmd_handler_t *handler, fluid_cmd_t *cmd) |
Register a new command to the handler. | |
FLUIDSYNTH_API int | fluid_cmd_handler_unregister (fluid_cmd_handler_t *handler, const char *cmd) |
Unregister a command from a command handler. | |
FLUIDSYNTH_API int | fluid_command (fluid_cmd_handler_t *handler, const char *cmd, fluid_ostream_t out) |
Process a string command. | |
FLUIDSYNTH_API int | fluid_source (fluid_cmd_handler_t *handler, const char *filename) |
Execute shell commands in a file. | |
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. | |
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. | |
FLUIDSYNTH_API void | delete_fluid_shell (fluid_shell_t *shell) |
Delete a FluidSynth command shell. | |
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. | |
FLUIDSYNTH_API void | delete_fluid_server (fluid_server_t *server) |
Delete a TCP/IP shell server. | |
FLUIDSYNTH_API int | fluid_server_join (fluid_server_t *server) |
Join a shell server thread (wait until it quits). |
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.
References fluid_get_stdin().
Referenced by fluid_get_stdin(), and fluid_usershell().
FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout | ( | void | ) |
Get standard output stream handle.
References fluid_get_stdout().
Referenced by fluid_get_stdout(), 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 |
References fluid_get_userconf().
Referenced by fluid_get_userconf().
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_get_sysconf().
Referenced by fluid_get_sysconf().
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(), fluid_cmd_t::name, and new_fluid_cmd_handler().
Referenced by new_fluid_cmd_handler().
FLUIDSYNTH_API void delete_fluid_cmd_handler | ( | fluid_cmd_handler_t * | handler | ) |
Delete a command handler.
handler | Command handler to delete |
References delete_fluid_cmd_handler().
Referenced by delete_fluid_cmd_handler().
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_cmd_handler_register(), FLUID_OK, and fluid_cmd_t::name.
Referenced by fluid_cmd_handler_register(), and 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_handler_unregister().
Referenced by fluid_cmd_handler_unregister().
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 |
References fluid_command().
Referenced by fluid_command().
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(), and fluid_source().
Referenced by fluid_source().
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(), fluid_get_stdout(), and fluid_usershell().
Referenced by fluid_usershell().
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(), FLUID_PANIC, and new_fluid_shell().
Referenced by new_fluid_shell().
FLUIDSYNTH_API void delete_fluid_shell | ( | fluid_shell_t * | shell | ) |
Delete a FluidSynth command shell.
shell | Command shell instance |
References delete_fluid_shell().
Referenced by delete_fluid_shell(), and 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, fluid_settings_getint(), and new_fluid_server().
Referenced by new_fluid_server().
FLUIDSYNTH_API void delete_fluid_server | ( | fluid_server_t * | server | ) |
Delete a TCP/IP shell server.
server | Shell server instance |
References delete_fluid_server().
Referenced by delete_fluid_server().
FLUIDSYNTH_API int fluid_server_join | ( | fluid_server_t * | server | ) |
Join a shell server thread (wait until it quits).
server | Shell server instance |
References fluid_server_join().
Referenced by fluid_server_join().