# include/fluidsynth/shell.h

    00001 /* FluidSynth - A Software Synthesizer
    00002  *
    00003  * Copyright (C) 2003  Peter Hanappe and others.
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Library General Public License
    00007  * as published by the Free Software Foundation; either version 2 of
    00008  * the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful, but
    00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Library General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Library General Public
    00016  * License along with this library; if not, write to the Free
    00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    00018  * 02111-1307, USA
    00019  */
    00020
    00021 #ifndef _FLUIDSYNTH_SHELL_H
    00022 #define _FLUIDSYNTH_SHELL_H
    00023
    00024
    00025 #ifdef __cplusplus
    00026 extern "C" {
    00027 #endif
    00028
    00029
    00030 /*
    00031  *
    00032  *   Shell interface
    00033  *
    00034  *   The shell interface allows you to send simple textual commands to
    00035  *   the synthesizer, to parse a command file, or to read commands
    00036  *   from the stdin or other input streams.
    00037  *
    00038  *   To find the list of currently supported commands, please check the
    00039  *   fluid_cmd.c file.
    00040  *
    00041  */
    00042
    00043 FLUIDSYNTH_API fluid_istream_t fluid_get_stdin(void);
    00044 FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout(void);
    00045
    00046 FLUIDSYNTH_API char* fluid_get_userconf(char* buf, int len);
    00047 FLUIDSYNTH_API char* fluid_get_sysconf(char* buf, int len);
    00048
    00049
    00052 typedef int (*fluid_cmd_func_t)(void* data, int ac, char** av, fluid_ostream_t out);
    00053
    00054 typedef struct {
    00055   char* name;
    00056   char* topic;
    00057   fluid_cmd_func_t handler;
    00058   void* data;
    00059   char* help;
    00060 } fluid_cmd_t;
    00061
    00062
    00073 FLUIDSYNTH_API
    00074 fluid_cmd_handler_t* new_fluid_cmd_handler(fluid_synth_t* synth);
    00075
    00076 FLUIDSYNTH_API
    00077 void delete_fluid_cmd_handler(fluid_cmd_handler_t* handler);
    00078
    00079 FLUIDSYNTH_API
    00080 void fluid_cmd_handler_set_synth(fluid_cmd_handler_t* handler, fluid_synth_t* synth);
    00081
    00090 FLUIDSYNTH_API
    00091 int fluid_cmd_handler_register(fluid_cmd_handler_t* handler, fluid_cmd_t* cmd);
    00092
    00093 FLUIDSYNTH_API
    00094 int fluid_cmd_handler_unregister(fluid_cmd_handler_t* handler, char* cmd);
    00095
    00096
    00099 FLUIDSYNTH_API
    00100 int fluid_command(fluid_cmd_handler_t* handler, char* cmd, fluid_ostream_t out);
    00101
    00102 FLUIDSYNTH_API
    00103 int fluid_source(fluid_cmd_handler_t* handler, char* filename);
    00104
    00105 FLUIDSYNTH_API
    00106 void fluid_usershell(fluid_settings_t* settings, fluid_cmd_handler_t* handler);
    00107
    00108
    00111 FLUIDSYNTH_API
    00112 fluid_shell_t* new_fluid_shell(fluid_settings_t* settings, fluid_cmd_handler_t* handler,
    00113                              fluid_istream_t in, fluid_ostream_t out, int thread);
    00114
    00115 FLUIDSYNTH_API void delete_fluid_shell(fluid_shell_t* shell);
    00116
    00117
    00118
    00121 typedef fluid_cmd_handler_t* (*fluid_server_newclient_func_t)(void* data, char* addr);
    00122
    00123 FLUIDSYNTH_API
    00124 fluid_server_t* new_fluid_server(fluid_settings_t* settings,
    00125                                fluid_server_newclient_func_t func,
    00126                                void* data);
    00127
    00128 FLUIDSYNTH_API void delete_fluid_server(fluid_server_t* server);
    00129
    00130 FLUIDSYNTH_API int fluid_server_join(fluid_server_t* server);
    00131
    00132
    00133 #ifdef __cplusplus
    00134 }
    00135 #endif
    00136
    00137 #endif /* _FLUIDSYNTH_SHELL_H */