mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-30 07:51:55 +00:00
Potential fix for #1059
Apply Christian's decay to sustain transition hack to modenv as well.
This commit is contained in:
parent
122066ca6d
commit
344796a6a8
2 changed files with 5 additions and 4 deletions
|
@ -64,7 +64,7 @@ struct _fluid_adsr_env_t
|
|||
/* For performance, all functions are inlined */
|
||||
|
||||
static FLUID_INLINE void
|
||||
fluid_adsr_env_calc(fluid_adsr_env_t *env, int is_volenv)
|
||||
fluid_adsr_env_calc(fluid_adsr_env_t *env)
|
||||
{
|
||||
fluid_env_data_t *env_data;
|
||||
fluid_real_t x;
|
||||
|
@ -76,7 +76,8 @@ fluid_adsr_env_calc(fluid_adsr_env_t *env, int is_volenv)
|
|||
{
|
||||
// If we're switching envelope stages from decay to sustain, force the value to be the end value of the previous stage
|
||||
// Hmm, should this only apply to volenv? It was so before refactoring, so keep it for now. [DH]
|
||||
if(env->section == FLUID_VOICE_ENVDECAY && is_volenv)
|
||||
// No, must apply to both, otherwise some voices may sound detuned. [TM] (https://github.com/FluidSynth/fluidsynth/issues/1059)
|
||||
if(env->section == FLUID_VOICE_ENVDECAY)
|
||||
{
|
||||
env->val = env_data->min * env_data->coeff;
|
||||
}
|
||||
|
|
|
@ -331,7 +331,7 @@ fluid_rvoice_write(fluid_rvoice_t *voice, fluid_real_t *dsp_buf)
|
|||
|
||||
/******************* vol env **********************/
|
||||
|
||||
fluid_adsr_env_calc(&voice->envlfo.volenv, 1);
|
||||
fluid_adsr_env_calc(&voice->envlfo.volenv);
|
||||
fluid_check_fpe("voice_write vol env");
|
||||
|
||||
if(fluid_adsr_env_get_section(&voice->envlfo.volenv) == FLUID_VOICE_ENVFINISHED)
|
||||
|
@ -341,7 +341,7 @@ fluid_rvoice_write(fluid_rvoice_t *voice, fluid_real_t *dsp_buf)
|
|||
|
||||
/******************* mod env **********************/
|
||||
|
||||
fluid_adsr_env_calc(&voice->envlfo.modenv, 0);
|
||||
fluid_adsr_env_calc(&voice->envlfo.modenv);
|
||||
fluid_check_fpe("voice_write mod env");
|
||||
|
||||
/******************* lfo **********************/
|
||||
|
|
Loading…
Reference in a new issue