adapt fluid_server API after cmd_handler decoupling

avoid new_fluid_server() to require an already existing instance of fluid_cmd_handler_t just for storing fluid_synth_t* and fluid_midi_router_t*, instead require these two instances explicitly when creating the server
This commit is contained in:
derselbst 2017-10-07 14:58:26 +02:00
parent 38984b0974
commit b79f2a614e
3 changed files with 9 additions and 7 deletions

View File

@ -114,8 +114,8 @@ FLUIDSYNTH_API void delete_fluid_shell(fluid_shell_t* shell);
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);

View File

@ -2006,7 +2006,8 @@ 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;
};
@ -2025,7 +2026,7 @@ static void fluid_server_close(fluid_server_t* server);
*/
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;
@ -2038,7 +2039,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);
@ -2108,7 +2110,7 @@ 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;
}

View File

@ -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");