From fe19ce0c24139417c9e66ab64fba6daba35f5a92 Mon Sep 17 00:00:00 2001 From: derselbst Date: Thu, 18 Jan 2018 20:24:58 +0100 Subject: [PATCH 1/2] remove fluid_synth_set_gen2() from public API --- doc/fluidsynth-v11-devdoc.txt | 1 + include/fluidsynth/synth.h | 3 --- src/synth/fluid_synth.h | 3 +++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/fluidsynth-v11-devdoc.txt b/doc/fluidsynth-v11-devdoc.txt index 83a60f94..551a7b38 100644 --- a/doc/fluidsynth-v11-devdoc.txt +++ b/doc/fluidsynth-v11-devdoc.txt @@ -83,6 +83,7 @@ Changes in FluidSynth 2.0.0 concerning developers: - remove deprecated fluid_synth_select_tuning(), use fluid_synth_activate_tuning(synth, chan, bank, prog, FALSE) instead - remove deprecated fluid_synth_reset_tuning(), use fluid_synth_deactivate_tuning(synth, chan, FALSE) instead - remove deprecated FLUID_HINT_INTEGER +- remove deprecated fluid_synth_set_gen2() as there doesnt seem to be a use case for absolute generator values - remove misspelled FLUID_SEQ_PITCHWHHELSENS macro - remove obsolete "audio.[out|in]put-channels" settings - remove unimplemented "synth.dump" setting diff --git a/include/fluidsynth/synth.h b/include/fluidsynth/synth.h index 12c68ecc..37e020df 100644 --- a/include/fluidsynth/synth.h +++ b/include/fluidsynth/synth.h @@ -219,9 +219,6 @@ enum fluid_interp { FLUIDSYNTH_API int fluid_synth_set_gen (fluid_synth_t* synth, int chan, int param, float value); -FLUIDSYNTH_API int fluid_synth_set_gen2 (fluid_synth_t* synth, int chan, - int param, float value, - int absolute, int normalized); FLUIDSYNTH_API float fluid_synth_get_gen(fluid_synth_t* synth, int chan, int param); diff --git a/src/synth/fluid_synth.h b/src/synth/fluid_synth.h index 4b894868..96d4dd8c 100644 --- a/src/synth/fluid_synth.h +++ b/src/synth/fluid_synth.h @@ -201,6 +201,9 @@ void fluid_synth_api_exit(fluid_synth_t* synth); void fluid_synth_process_event_queue(fluid_synth_t* synth); +int fluid_synth_set_gen2 (fluid_synth_t* synth, int chan, + int param, float value, + int absolute, int normalized); /* * misc */ From 5f8fabb65114f280dbc83ebf700e291b9b17cb6a Mon Sep 17 00:00:00 2001 From: derselbst Date: Thu, 18 Jan 2018 20:39:45 +0100 Subject: [PATCH 2/2] remove fluid_cmd_handler_register() from public API as well as fluid_cmd_handler_unregister() and fluid_cmd_t --- doc/fluidsynth-v11-devdoc.txt | 1 + include/fluidsynth/shell.h | 25 ------------------------- src/bindings/fluid_cmd.c | 29 +++++------------------------ src/bindings/fluid_cmd.h | 24 +++++++++++++++++++++++- 4 files changed, 29 insertions(+), 50 deletions(-) diff --git a/doc/fluidsynth-v11-devdoc.txt b/doc/fluidsynth-v11-devdoc.txt index 551a7b38..e54308cb 100644 --- a/doc/fluidsynth-v11-devdoc.txt +++ b/doc/fluidsynth-v11-devdoc.txt @@ -84,6 +84,7 @@ Changes in FluidSynth 2.0.0 concerning developers: - remove deprecated fluid_synth_reset_tuning(), use fluid_synth_deactivate_tuning(synth, chan, FALSE) instead - remove deprecated FLUID_HINT_INTEGER - remove deprecated fluid_synth_set_gen2() as there doesnt seem to be a use case for absolute generator values +- remove fluid_cmd_handler_register() and fluid_cmd_handler_unregister() from public API, as they seem to be unused downstream - remove misspelled FLUID_SEQ_PITCHWHHELSENS macro - remove obsolete "audio.[out|in]put-channels" settings - remove unimplemented "synth.dump" setting diff --git a/include/fluidsynth/shell.h b/include/fluidsynth/shell.h index d246c427..c20b2e25 100644 --- a/include/fluidsynth/shell.h +++ b/include/fluidsynth/shell.h @@ -42,26 +42,6 @@ FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout(void); FLUIDSYNTH_API char* fluid_get_userconf(char* buf, int len); FLUIDSYNTH_API char* fluid_get_sysconf(char* buf, int len); -/** - * Command handler function prototype. - * @param data User defined data - * @param ac Argument count - * @param av Array of string arguments - * @param out Output stream to send response to - * @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise - */ -typedef int (*fluid_cmd_func_t)(void* data, int ac, char** av, fluid_ostream_t out); - -/** - * Shell command information structure. - */ -typedef struct { - char* name; /**< The name of the command, as typed in the shell */ - char* topic; /**< The help topic group of this command */ - fluid_cmd_func_t handler; /**< Pointer to the handler for this command */ - void* data; /**< User data passed to the handler */ - char* help; /**< A help string */ -} fluid_cmd_t; /* The command handler */ @@ -74,11 +54,6 @@ void delete_fluid_cmd_handler(fluid_cmd_handler_t* handler); FLUIDSYNTH_API void fluid_cmd_handler_set_synth(fluid_cmd_handler_t* handler, fluid_synth_t* synth); -FLUIDSYNTH_API -int fluid_cmd_handler_register(fluid_cmd_handler_t* handler, fluid_cmd_t* cmd); - -FLUIDSYNTH_API -int fluid_cmd_handler_unregister(fluid_cmd_handler_t* handler, const char *cmd); /* Command function */ diff --git a/src/bindings/fluid_cmd.c b/src/bindings/fluid_cmd.c index 49bc1f4e..a6035efa 100644 --- a/src/bindings/fluid_cmd.c +++ b/src/bindings/fluid_cmd.c @@ -60,16 +60,6 @@ struct _fluid_shell_t { fluid_ostream_t out; }; -/** - * Reduced command information structure for constant data. - * For internal use only. - */ -typedef struct { - const char *name; /**< The name of the command, as typed in the shell */ - const char *topic; /**< The help topic group of this command */ - fluid_cmd_func_t handler; /**< Pointer to the handler for this command */ - const char *help; /**< A help string */ -} fluid_cmd_int_t; static fluid_thread_return_t fluid_shell_run(void* data); static void fluid_shell_init(fluid_shell_t* shell, @@ -87,7 +77,7 @@ void fluid_shell_settings(fluid_settings_t* settings) /** the table of all handled commands */ -static const fluid_cmd_int_t fluid_commands[] = { +static const fluid_cmd_t fluid_commands[] = { { "help", "general", fluid_handle_help, "help Show help topics ('help TOPIC' for more info)" }, { "quit", "general", fluid_handle_quit, @@ -2214,7 +2204,7 @@ fluid_expand_path(char* path, char* new_path, int len) * Command */ -fluid_cmd_t* fluid_cmd_copy(fluid_cmd_t* cmd) +fluid_cmd_t* fluid_cmd_copy(const fluid_cmd_t* cmd) { fluid_cmd_t* copy = FLUID_NEW(fluid_cmd_t); if (copy == NULL) { @@ -2226,7 +2216,6 @@ fluid_cmd_t* fluid_cmd_copy(fluid_cmd_t* cmd) copy->topic = FLUID_STRDUP(cmd->topic); copy->help = FLUID_STRDUP(cmd->help); copy->handler = cmd->handler; - copy->data = cmd->data; return copy; } @@ -2277,15 +2266,7 @@ fluid_cmd_handler_t* new_fluid_cmd_handler(fluid_synth_t* synth, fluid_midi_rout if (synth != NULL) { for (i = 0; i < FLUID_N_ELEMENTS(fluid_commands); i++) { - fluid_cmd_t cmd = { - (char *)fluid_commands[i].name, - (char *)fluid_commands[i].topic, - fluid_commands[i].handler, - handler, - (char *)fluid_commands[i].help - }; - - fluid_cmd_handler_register(handler, &cmd); + fluid_cmd_handler_register(handler, &fluid_commands[i]); } } @@ -2312,7 +2293,7 @@ delete_fluid_cmd_handler(fluid_cmd_handler_t* handler) * @return #FLUID_OK if command was inserted, #FLUID_FAILED otherwise */ int -fluid_cmd_handler_register(fluid_cmd_handler_t* handler, fluid_cmd_t* cmd) +fluid_cmd_handler_register(fluid_cmd_handler_t* handler, const fluid_cmd_t* cmd) { fluid_cmd_t* copy = fluid_cmd_copy(cmd); fluid_hashtable_insert(handler->commands, copy->name, copy); @@ -2340,7 +2321,7 @@ fluid_cmd_handler_handle(void* data, int ac, char** av, fluid_ostream_t out) cmd = fluid_hashtable_lookup(handler->commands, av[0]); if (cmd && cmd->handler) - return (*cmd->handler)(cmd->data, ac - 1, av + 1, out); + return (*cmd->handler)(handler, ac - 1, av + 1, out); fluid_ostream_printf(out, "unknown command: %s (try help)\n", av[0]); return FLUID_FAILED; diff --git a/src/bindings/fluid_cmd.h b/src/bindings/fluid_cmd.h index 8c54b968..9a132811 100644 --- a/src/bindings/fluid_cmd.h +++ b/src/bindings/fluid_cmd.h @@ -95,13 +95,35 @@ int fluid_handle_ladspa_stop(void *data, int ac, char **av, fluid_ostream_t out) int fluid_handle_ladspa_reset(void *data, int ac, char **av, fluid_ostream_t out); #endif -fluid_cmd_t* fluid_cmd_copy(fluid_cmd_t* cmd); +/** + * Command handler function prototype. + * @param data User defined data + * @param ac Argument count + * @param av Array of string arguments + * @param out Output stream to send response to + * @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise + */ +typedef int (*fluid_cmd_func_t)(void* data, int ac, char** av, fluid_ostream_t out); + +/** + * Shell command information structure. + */ +typedef struct { + char* name; /**< The name of the command, as typed in the shell */ + char* topic; /**< The help topic group of this command */ + fluid_cmd_func_t handler; /**< Pointer to the handler for this command */ + char* help; /**< A help string */ +} fluid_cmd_t; + +fluid_cmd_t* fluid_cmd_copy(const fluid_cmd_t* cmd); void delete_fluid_cmd(fluid_cmd_t* cmd); int fluid_cmd_handler_handle(void* data, int ac, char** av, fluid_ostream_t out); +int fluid_cmd_handler_register(fluid_cmd_handler_t* handler, const fluid_cmd_t* cmd); +int fluid_cmd_handler_unregister(fluid_cmd_handler_t* handler, const char *cmd); void fluid_server_remove_client(fluid_server_t* server, fluid_client_t* client);