mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-01-19 07:50:49 +00:00
Merge branch 'master' into sm24
This commit is contained in:
commit
daf85aec02
5 changed files with 39 additions and 39 deletions
|
@ -80,9 +80,12 @@ Changes in FluidSynth @NEXT_RELEASE@ concerning developers:
|
|||
- remove obsolete "audio.[out|in]put-channels" settings
|
||||
- remove unimplemented "synth.dump" setting
|
||||
- remove fluid_synth_set_gen2(), fluid_synth_set_gen() now behaves as fluid_synth_set_gen2()
|
||||
- remove struct fluid_mod_t from public API, use the getters and setters of mod.h instead
|
||||
- remove struct _fluid_gen_t, fluid_gen_set_default_values() and enum fluid_gen_flags from public API
|
||||
|
||||
- all public \c fluid_settings_* functions that return an integer which is not meant to be interpreted as bool consistently return either FLUID_OK or FLUID_FAILED
|
||||
- struct fluid_mod_t was removed from public API
|
||||
- struct _fluid_gen_t, fluid_gen_set_default_values() and enum fluid_gen_flags were removed from public API
|
||||
- the shell command handler was decoupled internally, as a consequence the param list of new_fluid_server() and new_fluid_cmd_handler() was adapted
|
||||
|
||||
- add "synth.volenv" a setting for volume envelope processing
|
||||
- add support for polyonic key pressure events, see fluid_event_key_pressure()
|
||||
- add fluid_synth_add_default_mod() for manipulating default modulators
|
||||
|
|
|
@ -63,16 +63,6 @@ typedef struct {
|
|||
char* help; /**< A help string */
|
||||
} fluid_cmd_t;
|
||||
|
||||
/* the shell cmd handler struct */
|
||||
typedef struct {
|
||||
fluid_synth_t* synth;
|
||||
fluid_midi_router_t* router;
|
||||
fluid_cmd_hash_t* commands;
|
||||
|
||||
fluid_midi_router_rule_t *cmd_rule; /* Rule currently being processed by shell command handler */
|
||||
int cmd_rule_type; /* Type of the rule (#fluid_midi_router_rule_type) */
|
||||
} fluid_cmd_handler_t;
|
||||
|
||||
/* The command handler */
|
||||
|
||||
FLUIDSYNTH_API
|
||||
|
@ -115,17 +105,10 @@ FLUIDSYNTH_API void delete_fluid_shell(fluid_shell_t* shell);
|
|||
|
||||
/* TCP/IP server */
|
||||
|
||||
/**
|
||||
* Callback function which is executed for new server connections.
|
||||
* @param data User defined data supplied in call to new_fluid_server()
|
||||
* @param addr The IP address of the client (can be NULL)
|
||||
* @return Should return a new command handler for the connection (new_fluid_cmd_handler()).
|
||||
*/
|
||||
typedef fluid_cmd_handler_t* (*fluid_server_newclient_func_t)(void* data, char* addr, char* addr2);
|
||||
|
||||
FLUIDSYNTH_API
|
||||
fluid_server_t* new_fluid_server(fluid_settings_t* settings,
|
||||
fluid_cmd_handler_t* handler);
|
||||
fluid_server_t* new_fluid_server(fluid_settings_t* settings,
|
||||
fluid_synth_t* synth, fluid_midi_router_t* router);
|
||||
|
||||
FLUIDSYNTH_API void delete_fluid_server(fluid_server_t* server);
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ typedef struct _fluid_event_t fluid_event_t; /**< Sequencer e
|
|||
typedef struct _fluid_sequencer_t fluid_sequencer_t; /**< Sequencer instance */
|
||||
typedef struct _fluid_ramsfont_t fluid_ramsfont_t; /**< RAM SoundFont */
|
||||
typedef struct _fluid_rampreset_t fluid_rampreset_t; /**< RAM SoundFont preset */
|
||||
typedef struct _fluid_cmd_handler_t fluid_cmd_handler_t; /**< Shell Command Handler */
|
||||
|
||||
typedef int fluid_istream_t; /**< Input stream descriptor */
|
||||
typedef int fluid_ostream_t; /**< Output stream descriptor */
|
||||
|
|
|
@ -39,6 +39,18 @@
|
|||
#define MAX_COMMAND_LEN 1024 /* max command length accepted by fluid_command() */
|
||||
#define FLUID_WORKLINELENGTH 1024 /* LADSPA plugins use long command lines */
|
||||
|
||||
|
||||
/* the shell cmd handler struct */
|
||||
struct _fluid_cmd_handler_t {
|
||||
fluid_synth_t* synth;
|
||||
fluid_midi_router_t* router;
|
||||
fluid_cmd_hash_t* commands;
|
||||
|
||||
fluid_midi_router_rule_t *cmd_rule; /* Rule currently being processed by shell command handler */
|
||||
int cmd_rule_type; /* Type of the rule (#fluid_midi_router_rule_type) */
|
||||
};
|
||||
|
||||
|
||||
struct _fluid_shell_t {
|
||||
fluid_settings_t* settings;
|
||||
fluid_cmd_handler_t* handler;
|
||||
|
@ -63,7 +75,7 @@ void fluid_shell_settings(fluid_settings_t* settings)
|
|||
|
||||
/** the table of all handled commands */
|
||||
|
||||
fluid_cmd_t fluid_commands[] = {
|
||||
static fluid_cmd_t fluid_commands[] = {
|
||||
{ "help", "general", (fluid_cmd_func_t) fluid_handle_help, NULL,
|
||||
"help Show help topics ('help TOPIC' for more info)" },
|
||||
{ "quit", "general", (fluid_cmd_func_t) fluid_handle_quit, NULL,
|
||||
|
@ -1899,9 +1911,9 @@ fluid_cmd_handler_destroy_hash_value (void *value)
|
|||
|
||||
/**
|
||||
* Create a new command handler.
|
||||
* @param synth If not NULL, all the default synthesizer commands will be
|
||||
* added to the new handler.
|
||||
* @return New command handler
|
||||
* @param synth If not NULL, all the default synthesizer commands will be added to the new handler.
|
||||
* @param router If not NULL, all the default midi_router commands will be added to the new handler.
|
||||
* @return New command handler, or NULL if alloc failed
|
||||
*/
|
||||
fluid_cmd_handler_t* new_fluid_cmd_handler(fluid_synth_t* synth, fluid_midi_router_t* router)
|
||||
{
|
||||
|
@ -1923,8 +1935,11 @@ fluid_cmd_handler_t* new_fluid_cmd_handler(fluid_synth_t* synth, fluid_midi_rout
|
|||
handler->router = router;
|
||||
|
||||
if (synth != NULL) {
|
||||
for (i = 0; fluid_commands[i].name != NULL; i++) {
|
||||
fluid_cmd_handler_register(handler, &fluid_commands[i]);
|
||||
for (i = 0; fluid_commands[i].name != NULL; i++)
|
||||
{
|
||||
fluid_commands[i].data = handler;
|
||||
fluid_cmd_handler_register(handler, &fluid_commands[i]);
|
||||
fluid_commands[i].data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1986,12 +2001,11 @@ fluid_cmd_handler_handle(fluid_cmd_handler_t* handler, int ac, char** av, fluid_
|
|||
#if !defined(WITHOUT_SERVER)
|
||||
|
||||
|
||||
|
||||
struct _fluid_server_t {
|
||||
fluid_server_socket_t* socket;
|
||||
fluid_settings_t* settings;
|
||||
fluid_server_newclient_func_t newclient;
|
||||
fluid_cmd_handler_t* handler;
|
||||
fluid_synth_t* synth;
|
||||
fluid_midi_router_t* router;
|
||||
fluid_list_t* clients;
|
||||
fluid_mutex_t mutex;
|
||||
};
|
||||
|
@ -2004,13 +2018,13 @@ static void fluid_server_close(fluid_server_t* server);
|
|||
/**
|
||||
* Create a new TCP/IP command shell server.
|
||||
* @param settings Settings instance to use for the shell
|
||||
* @param newclient Callback function to call for each new client connection
|
||||
* @param data User defined data to pass to \a newclient callback
|
||||
* @param synth If not NULL, the synth instance for the command handler to be used by the client
|
||||
* @param router If not NULL, the midi_router instance for the command handler to be used by the client
|
||||
* @return New shell server instance or NULL on error
|
||||
*/
|
||||
fluid_server_t*
|
||||
new_fluid_server(fluid_settings_t* settings,
|
||||
fluid_cmd_handler_t* handler)
|
||||
fluid_synth_t* synth, fluid_midi_router_t* router)
|
||||
{
|
||||
fluid_server_t* server;
|
||||
int port;
|
||||
|
@ -2023,7 +2037,8 @@ new_fluid_server(fluid_settings_t* settings,
|
|||
|
||||
server->settings = settings;
|
||||
server->clients = NULL;
|
||||
server->handler = handler;
|
||||
server->synth = synth;
|
||||
server->router = router;
|
||||
|
||||
fluid_mutex_init(server->mutex);
|
||||
|
||||
|
@ -2093,13 +2108,14 @@ fluid_server_handle_connection(fluid_server_t* server, fluid_socket_t client_soc
|
|||
fluid_client_t* client;
|
||||
fluid_cmd_handler_t* handler;
|
||||
|
||||
handler = new_fluid_cmd_handler(server->handler->synth, server->handler->router);
|
||||
handler = new_fluid_cmd_handler(server->synth, server->router);
|
||||
if (handler == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
client = new_fluid_client(server, server->settings, handler, client_socket);
|
||||
if (client == NULL) {
|
||||
delete_fluid_cmd_handler(handler);
|
||||
return -1;
|
||||
}
|
||||
fluid_server_add_client(server, client);
|
||||
|
@ -2132,8 +2148,6 @@ int fluid_server_join(fluid_server_t* server)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
struct _fluid_client_t {
|
||||
fluid_server_t* server;
|
||||
fluid_settings_t* settings;
|
||||
|
@ -2143,7 +2157,6 @@ struct _fluid_client_t {
|
|||
};
|
||||
|
||||
|
||||
|
||||
static void fluid_client_run(fluid_client_t* client)
|
||||
{
|
||||
fluid_shell_t shell;
|
||||
|
|
|
@ -704,7 +704,7 @@ int main(int argc, char** argv)
|
|||
/* run the server, if requested */
|
||||
#if !defined(MACINTOSH)
|
||||
if (with_server) {
|
||||
server = new_fluid_server(settings, cmd_handler);
|
||||
server = new_fluid_server(settings, synth, router);
|
||||
if (server == NULL) {
|
||||
fprintf(stderr, "Failed to create the server.\n"
|
||||
"Continuing without it.\n");
|
||||
|
|
Loading…
Reference in a new issue