Merge pull request #330 from FluidSynth/api-clean

remove unused API functions
* fluid_synth_set_gen2()
* fluid_cmd_handler_register()
* fluid_cmd_handler_unregister()
* fluid_cmd_t
This commit is contained in:
Tom M 2018-01-27 14:34:09 +01:00 committed by GitHub
commit 2a4b2084f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 53 deletions

View File

@ -83,6 +83,8 @@ 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 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

View File

@ -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 */

View File

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

View File

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

View File

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

View File

@ -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
*/