mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 06:51:54 +00:00
Return zero if both mod sources are NONE
This commit is contained in:
parent
ef1f409c5f
commit
35212c55b8
1 changed files with 7 additions and 9 deletions
|
@ -391,15 +391,21 @@ fluid_mod_transform_source_value(fluid_real_t val, unsigned char mod_flags, cons
|
||||||
* Output = Amount * Map(primary source input) * Map(secondary source input)
|
* Output = Amount * Map(primary source input) * Map(secondary source input)
|
||||||
*
|
*
|
||||||
* 2) When a source is set to FLUID_MOD_NONE, its input value is treated as +1.0
|
* 2) When a source is set to FLUID_MOD_NONE, its input value is treated as +1.0
|
||||||
|
* 3) When both sources are FLUID_MOD_NONE, zero is returned
|
||||||
*/
|
*/
|
||||||
fluid_real_t
|
fluid_real_t
|
||||||
fluid_mod_get_value(fluid_mod_t *mod, fluid_voice_t *voice)
|
fluid_mod_get_value(fluid_mod_t *mod, fluid_voice_t *voice)
|
||||||
{
|
{
|
||||||
extern fluid_mod_t default_vel2filter_mod;
|
extern fluid_mod_t default_vel2filter_mod;
|
||||||
|
|
||||||
fluid_real_t v1, v2;
|
fluid_real_t v1 = 1.0f, v2 = 1.0f;
|
||||||
fluid_real_t range1 = 127.0, range2 = 127.0;
|
fluid_real_t range1 = 127.0, range2 = 127.0;
|
||||||
|
|
||||||
|
if(mod->src1 == FLUID_MOD_NONE || mod->src2 == FLUID_MOD_NONE)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* 'special treatment' for default controller
|
/* 'special treatment' for default controller
|
||||||
*
|
*
|
||||||
* Reference: SF2.01 section 8.4.2
|
* Reference: SF2.01 section 8.4.2
|
||||||
|
@ -444,10 +450,6 @@ fluid_mod_get_value(fluid_mod_t *mod, fluid_voice_t *voice)
|
||||||
/* transform the input value */
|
/* transform the input value */
|
||||||
v1 = fluid_mod_transform_source_value(v1, mod->flags1, range1);
|
v1 = fluid_mod_transform_source_value(v1, mod->flags1, range1);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
v1 = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the second input source */
|
/* get the second input source */
|
||||||
if(mod->src2 > FLUID_MOD_NONE)
|
if(mod->src2 > FLUID_MOD_NONE)
|
||||||
|
@ -457,10 +459,6 @@ fluid_mod_get_value(fluid_mod_t *mod, fluid_voice_t *voice)
|
||||||
/* transform the second input value */
|
/* transform the second input value */
|
||||||
v2 = fluid_mod_transform_source_value(v2, mod->flags2, range2);
|
v2 = fluid_mod_transform_source_value(v2, mod->flags2, range2);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
v2 = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* it's as simple as that: */
|
/* it's as simple as that: */
|
||||||
return (fluid_real_t) mod->amount * v1 * v2;
|
return (fluid_real_t) mod->amount * v1 * v2;
|
||||||
|
|
Loading…
Reference in a new issue