Remove dest0_idx param in fluid_linked_branch_test_identity()

- This parameter was useful only with old recursive implementation
  of this function.
This commit is contained in:
jjceresa 2019-10-01 16:40:38 +02:00
parent a87162746e
commit 6ce17ed648
5 changed files with 13 additions and 19 deletions

View file

@ -696,7 +696,7 @@ fluid_defpreset_next(fluid_defpreset_t *defpreset)
/*
Print a simple modulator or all modulator members of a complex modulator.
@param mod, pointer on first member.
@param mod_idx, modulator index (displayed in the header).
@param mod_idx, modulator index (displayed in the header).
@param offset, offset to add to each index member.
*/
void fluid_dump_linked_mod(fluid_mod_t *mod, int mod_idx, int offset)
@ -850,7 +850,7 @@ fluid_defpreset_noteon_add_linked_mod_to_voice(fluid_voice_t *voice,
for(i = 0; i < identity_limit_count; i++)
{
if(fluid_linked_mod_test_identity(global_mod,0, mod_list[i],
if(fluid_linked_mod_test_identity(global_mod, mod_list[i],
FLUID_LINKED_MOD_TEST_ONLY))
{
break;

View file

@ -821,8 +821,6 @@ int fluid_mod_check_sources(const fluid_mod_t *mod, char *name)
* @param cm0_mod, pointer on modulator branch 0. Must be the modulator following
* cm0 ending modulator. In the figure above this is cm0.m1.
*
* @param dest0_idx, index of cm0 ending modulator. In the figure cm0.m0 index.
*
* @param cm1_mod, pointer on modulator branch 1. Must be the modulator following
* cm1 ending modulator. In the figure above this is cm1.m1.
*
@ -836,7 +834,6 @@ int fluid_mod_check_sources(const fluid_mod_t *mod, char *name)
* @return TRUE if complex modulators branches are identical, FALSE otherwise.
*/
static int fluid_linked_branch_test_identity(fluid_mod_t *cm0_mod,
unsigned char dest0_idx,
fluid_mod_t *cm1_mod,
unsigned char test_mode)
{
@ -856,11 +853,11 @@ static int fluid_linked_branch_test_identity(fluid_mod_t *cm0_mod,
/* destination index of cm1 branch */
branch_level[0].dest1_idx = FLUID_MOD_LINK_DEST;
/* destination index of cm0 branch 0*/
dest0_idx |= FLUID_MOD_LINK_DEST;
branch_level[0].dest0_idx = dest0_idx;
mod0_idx = cm0_mod->dest;
branch_level[0].dest0_idx = mod0_idx;
/* verify identity of each member of branches */
mod0_idx = dest0_idx + 1; /* current cm0_mod index */
mod0_idx++; /* current cm0_mod index */
while(r)
{
unsigned char dest1_idx = branch_level[state_idx].dest1_idx;
@ -961,8 +958,6 @@ static int fluid_linked_branch_test_identity(fluid_mod_t *cm0_mod,
* @param cm0, final modulator of a complex linked modulators.
* cm0 must be connected to a generator.
*
* @param cm0_idx, index of cm0.
*
* @param cm1, final modulator of complex linked modulators.
* cm1 must be connected to a generator.
*
@ -975,7 +970,7 @@ static int fluid_linked_branch_test_identity(fluid_mod_t *cm0_mod,
*
* @return TRUE if complex modulators are identical, FALSE otherwise.
*/
int fluid_linked_mod_test_identity(fluid_mod_t *cm0,unsigned char cm0_idx,
int fluid_linked_mod_test_identity(fluid_mod_t *cm0,
fluid_mod_t *cm1,
unsigned char test_mode)
{
@ -998,7 +993,7 @@ int fluid_linked_mod_test_identity(fluid_mod_t *cm0,unsigned char cm0_idx,
}
/* identity test of branches of cm0 and cm1 */
{
return fluid_linked_branch_test_identity(cm0->next, cm0_idx, cm1->next,
return fluid_linked_branch_test_identity(cm0->next, cm1->next,
test_mode);
}
}

View file

@ -64,8 +64,7 @@ enum fluid_linked_mod_test_identity
FLUID_LINKED_MOD_TEST_ADD, /**< test identity and add (sum) modulator amounts */
};
int fluid_linked_mod_test_identity(fluid_mod_t *cm0,unsigned char cm0_idx,
fluid_mod_t *cm1,
int fluid_linked_mod_test_identity(fluid_mod_t *cm0, fluid_mod_t *cm1,
unsigned char test_mode);
fluid_real_t fluid_mod_get_value(fluid_mod_t *mod, fluid_voice_t *voice);

View file

@ -1609,11 +1609,11 @@ fluid_voice_add_mod_local(fluid_voice_t *voice, fluid_mod_t *mod, int mode, int
/* skip unlinked modulators */
if (voice->mod[i].next)
{
if(fluid_linked_mod_test_identity(&voice->mod[i],i,mod,
if(fluid_linked_mod_test_identity(&voice->mod[i], mod,
FLUID_LINKED_MOD_TEST_ONLY))
{
/* add amount */
fluid_linked_mod_test_identity(&voice->mod[i],i, mod,
fluid_linked_mod_test_identity(&voice->mod[i], mod,
FLUID_LINKED_MOD_TEST_ADD);
return;
}

View file

@ -1246,7 +1246,7 @@ static void fluid_linked_mod_dump_test_identity(fluid_mod_t *mod0, fluid_mod_t *
fluid_dump_linked_mod(cm1, 0, 0);
/* Calling fluid_linked_mod_test_identity() */
r = fluid_linked_mod_test_identity(cm0, 0, cm1,
r = fluid_linked_mod_test_identity(cm0, cm1,
FLUID_LINKED_MOD_TEST_ONLY);
/* display identity result */
@ -1261,12 +1261,12 @@ static void fluid_linked_mod_dump_test_identity(fluid_mod_t *mod0, fluid_mod_t *
if(r)
{
/* add amount to cm0 */
fluid_linked_mod_test_identity(cm0, 0, cm1, FLUID_LINKED_MOD_TEST_ADD);
fluid_linked_mod_test_identity(cm0, cm1, FLUID_LINKED_MOD_TEST_ADD);
FLUID_LOG(FLUID_INFO, "-- complex modulator added cm1 amount to cm0 amount");
fluid_dump_linked_mod(cm0, 0, 0);
/* overwrite cm0 amount by cm1 amount */
fluid_linked_mod_test_identity(cm0, 0, cm1, FLUID_LINKED_MOD_TEST_OVERWRITE);
fluid_linked_mod_test_identity(cm0, cm1, FLUID_LINKED_MOD_TEST_OVERWRITE);
FLUID_LOG(FLUID_INFO, "-- complex modulator overwrite cm0 amount by cm1 amount");
fluid_dump_linked_mod(cm0, 0, 0);
}