diff options
Diffstat (limited to 'libs/fluidsynth/src/fluid_synth.c')
-rw-r--r-- | libs/fluidsynth/src/fluid_synth.c | 59 |
1 files changed, 11 insertions, 48 deletions
diff --git a/libs/fluidsynth/src/fluid_synth.c b/libs/fluidsynth/src/fluid_synth.c index 42064f93d6..570a2535cd 100644 --- a/libs/fluidsynth/src/fluid_synth.c +++ b/libs/fluidsynth/src/fluid_synth.c @@ -131,11 +131,6 @@ static void fluid_synth_handle_reverb_chorus_int(void *data, const char *name, i static void fluid_synth_reset_basic_channel_LOCAL(fluid_synth_t *synth, int chan, int nbr_chan); static int fluid_synth_check_next_basic_channel(fluid_synth_t *synth, int basicchan, int mode, int val); static void fluid_synth_set_basic_channel_LOCAL(fluid_synth_t *synth, int basicchan, int mode, int val); -static int fluid_synth_set_reverb_full_LOCAL(fluid_synth_t *synth, int set, double roomsize, - double damping, double width, double level); - -static int fluid_synth_set_chorus_full_LOCAL(fluid_synth_t *synth, int set, int nr, double level, - double speed, double depth_ms, int type); /*************************************************************** * @@ -915,7 +910,7 @@ new_fluid_synth(fluid_settings_t *settings) fluid_settings_getnum(settings, "synth.reverb.width", &width); fluid_settings_getnum(settings, "synth.reverb.level", &level); - fluid_synth_set_reverb_full_LOCAL(synth, + fluid_synth_set_reverb_full(synth, FLUID_REVMODEL_SET_ALL, room, damp, @@ -931,7 +926,7 @@ new_fluid_synth(fluid_settings_t *settings) fluid_settings_getnum(settings, "synth.chorus.speed", &speed); fluid_settings_getnum(settings, "synth.chorus.depth", &depth); - fluid_synth_set_chorus_full_LOCAL(synth, + fluid_synth_set_chorus_full(synth, FLUID_CHORUS_SET_ALL, i, level, @@ -987,8 +982,6 @@ delete_fluid_synth(fluid_synth_t *synth) fluid_list_t *list; fluid_sfont_t *sfont; fluid_sfloader_t *loader; - fluid_mod_t *default_mod; - fluid_mod_t *mod; fluid_return_if_fail(synth != NULL); @@ -1107,14 +1100,7 @@ delete_fluid_synth(fluid_synth_t *synth) #endif /* delete all default modulators */ - default_mod = synth->default_mod; - - while(default_mod != NULL) - { - mod = default_mod; - default_mod = mod->next; - delete_fluid_mod(mod); - } + delete_fluid_list_mod(synth->default_mod); FLUID_FREE(synth->overflow.important_channels); @@ -1354,6 +1340,7 @@ fluid_synth_add_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod, int mo fluid_return_val_if_fail(synth != NULL, FLUID_FAILED); fluid_return_val_if_fail(mod != NULL, FLUID_FAILED); + fluid_return_val_if_fail((mode == FLUID_SYNTH_ADD) || (mode == FLUID_SYNTH_OVERWRITE) , FLUID_FAILED); /* Checks if modulators sources are valid */ if(!fluid_mod_check_sources(mod, "api fluid_synth_add_default_mod mod")) @@ -1373,14 +1360,10 @@ fluid_synth_add_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod, int mo { default_mod->amount += mod->amount; } - else if(mode == FLUID_SYNTH_OVERWRITE) + else // mode == FLUID_SYNTH_OVERWRITE { default_mod->amount = mod->amount; } - else - { - FLUID_API_RETURN(FLUID_FAILED); - } FLUID_API_RETURN(FLUID_OK); } @@ -1419,7 +1402,7 @@ fluid_synth_add_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod, int mo * @param mod The modulator to remove * @return #FLUID_OK if a matching modulator was found and successfully removed, #FLUID_FAILED otherwise * - * @note Not realtime safe (due to internal memory allocation) and therefore should not be called + * @note Not realtime safe (due to internal memory freeing) and therefore should not be called * from synthesis context at the risk of stalling audio output. */ int @@ -1440,7 +1423,7 @@ fluid_synth_remove_default_mod(fluid_synth_t *synth, const fluid_mod_t *mod) { if(synth->default_mod == default_mod) { - synth->default_mod = synth->default_mod->next; + synth->default_mod = default_mod->next; } else { @@ -5072,6 +5055,7 @@ fluid_synth_set_reverb_full(fluid_synth_t *synth, int set, double roomsize, double damping, double width, double level) { int ret; + fluid_rvoice_param_t param[MAX_EVENT_PARAMS]; fluid_return_val_if_fail(synth != NULL, FLUID_FAILED); /* if non of the flags is set, fail */ @@ -5080,16 +5064,6 @@ fluid_synth_set_reverb_full(fluid_synth_t *synth, int set, double roomsize, /* Synth shadow values are set here so that they will be returned if querried */ fluid_synth_api_enter(synth); - ret = fluid_synth_set_reverb_full_LOCAL(synth, set, roomsize, damping, width, level); - FLUID_API_RETURN(ret); -} - -static int -fluid_synth_set_reverb_full_LOCAL(fluid_synth_t *synth, int set, double roomsize, - double damping, double width, double level) -{ - int ret; - fluid_rvoice_param_t param[MAX_EVENT_PARAMS]; if(set & FLUID_REVMODEL_SET_ROOMSIZE) { @@ -5121,7 +5095,7 @@ fluid_synth_set_reverb_full_LOCAL(fluid_synth_t *synth, int set, double roomsize fluid_rvoice_mixer_set_reverb_params, synth->eventhandler->mixer, param); - return ret; + FLUID_API_RETURN(ret); } /** @@ -5287,6 +5261,7 @@ fluid_synth_set_chorus_full(fluid_synth_t *synth, int set, int nr, double level, double speed, double depth_ms, int type) { int ret; + fluid_rvoice_param_t param[MAX_EVENT_PARAMS]; fluid_return_val_if_fail(synth != NULL, FLUID_FAILED); /* if non of the flags is set, fail */ @@ -5295,18 +5270,6 @@ fluid_synth_set_chorus_full(fluid_synth_t *synth, int set, int nr, double level, /* Synth shadow values are set here so that they will be returned if queried */ fluid_synth_api_enter(synth); - ret = fluid_synth_set_chorus_full_LOCAL(synth, set, nr, level, speed, depth_ms, type); - - FLUID_API_RETURN(ret); -} - -static int -fluid_synth_set_chorus_full_LOCAL(fluid_synth_t *synth, int set, int nr, double level, - double speed, double depth_ms, int type) -{ - int ret; - fluid_rvoice_param_t param[MAX_EVENT_PARAMS]; - if(set & FLUID_CHORUS_SET_NR) { synth->chorus_nr = nr; @@ -5343,7 +5306,7 @@ fluid_synth_set_chorus_full_LOCAL(fluid_synth_t *synth, int set, int nr, double synth->eventhandler->mixer, param); - return (ret); + FLUID_API_RETURN(ret); } /** |