fix left operand of '>>' being a garbage value

This commit is contained in:
derselbst 2019-07-11 10:11:55 +02:00
parent aa0217826c
commit 0362c6c646
1 changed files with 9 additions and 3 deletions

View File

@ -1216,7 +1216,6 @@ int fluid_voice_modulate(fluid_voice_t* voice, int cc, int ctrl)
for (i = 0; i < voice->mod_count; i++)
{
mod = &voice->mod[i];
/* memorize gen destination.
Linked modulators are grouped consecutively to form a complex modulator.
@ -1229,7 +1228,15 @@ int fluid_voice_modulate(fluid_voice_t* voice, int cc, int ctrl)
{
gen = mod->dest; /* keep only generator destination */
}
/* gen is always a valid generator ID destination from:
else
{
if(i == 0)
{
/* The first modulator must be a non-linked modulator to avoid gen being uninitialized */
return FLUID_FAILED;
}
}
/* At this point, gen is always a valid generator ID destination from:
- a non-linked modulator or
- a complex modulator.
*/
@ -1239,7 +1246,6 @@ int fluid_voice_modulate(fluid_voice_t* voice, int cc, int ctrl)
are updated */
if(ctrl < 0 || fluid_mod_has_source(mod, cc, ctrl))
{
/* Skip if this generator has already been updated */
if(!is_gen_updated(updated_gen_bit, gen))
{