shell.h File Reference

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_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.
FLUIDSYNTH_API void delete_fluid_shell (fluid_shell_t *shell)
 Delete a FluidSynth command shell.
FLUIDSYNTH_API fluid_server_tnew_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).

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.


Typedef Documentation

typedef int(* fluid_cmd_func_t)(void *data, int ac, char **av, fluid_ostream_t out)

Command handler function prototype.

Parameters:
data User defined data
ac Argument count
av Array of string arguments
out Output stream to send response to
Returns:
Should return FLUID_OK on success, FLUID_FAILED otherwise
typedef fluid_cmd_handler_t*(* fluid_server_newclient_func_t)(void *data, char *addr)

Callback function which is executed for new server connections.

Parameters:
data User defined data supplied in call to new_fluid_server()
addr The IP address of the client (can be NULL)
Returns:
Should return a new command handler for the connection (new_fluid_cmd_handler()).

Function Documentation

FLUIDSYNTH_API fluid_istream_t fluid_get_stdin ( void   ) 

Get standard in stream handle.

Returns:
Standard in stream.

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.

Returns:
Standard out stream.

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.

Parameters:
buf Caller supplied string buffer to store file name to.
len Length of buf
Returns:
Returns buf pointer or NULL if no user command file for this system type.

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.

Parameters:
buf Caller supplied string buffer to store file name to.
len Length of buf
Returns:
Returns buf pointer or NULL if no system command file for this system type.

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.

Parameters:
synth If not NULL, all the default synthesizer commands will be added to the new handler.
Returns:
New command 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.

Parameters:
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.

Parameters:
handler Command handler instance
cmd Command info (gets copied)
Returns:
FLUID_OK if command was inserted, FLUID_FAILED otherwise

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.

Parameters:
handler Command handler instance
cmd Name of the command
Returns:
TRUE if command was found and unregistered, FALSE otherwise

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.

Parameters:
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

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.

Parameters:
handler Command handler callback
filename File name
Returns:
0 on success, a value >1 on error

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.

Parameters:
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.

Parameters:
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")
Returns:
New shell instance or NULL on error

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.

Parameters:
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.

Parameters:
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
Returns:
New shell server instance or NULL on error

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.

Parameters:
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).

Parameters:
server Shell server instance
Returns:
FLUID_OK on success, FLUID_FAILED otherwise

References fluid_server_join().

Referenced by fluid_server_join().

Generated on Mon Sep 6 12:29:27 2010 for libfluidsynth by  doxygen 1.6.3