Merge pull request #561 from FluidSynth/synth-default-mod

Minor cleanups
This commit is contained in:
Tom M 2019-09-23 18:03:06 +02:00 committed by GitHub
commit 7fac580ae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 18 deletions

View File

@ -1151,7 +1151,7 @@ new_fluid_preset_zone(char *name)
/*
* delete list of modulators.
*/
static void delete_fluid_list_mod(fluid_mod_t *mod)
void delete_fluid_list_mod(fluid_mod_t *mod)
{
fluid_mod_t *tmp;

View File

@ -178,6 +178,7 @@ struct _fluid_preset_zone_t
};
fluid_preset_zone_t *new_fluid_preset_zone(char *name);
void delete_fluid_list_mod(fluid_mod_t *mod);
void delete_fluid_preset_zone(fluid_preset_zone_t *zone);
fluid_preset_zone_t *fluid_preset_zone_next(fluid_preset_zone_t *zone);
int fluid_preset_zone_import_sfont(fluid_preset_zone_t *zone, SFZone *sfzone, fluid_defsfont_t *defssfont);

View File

@ -988,8 +988,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);
@ -1108,14 +1106,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);
@ -1355,6 +1346,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"))
@ -1374,14 +1366,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);
}
@ -1420,7 +1408,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
@ -1441,7 +1429,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
{