diff options
author | Chris Robinson <[email protected]> | 2017-04-28 10:21:15 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-04-28 10:25:22 -0700 |
commit | 9767f4f9c3d61729e56699756c1c390547faf1df (patch) | |
tree | a9acc346c10a9ca4a583c4b41b75d23553b68b46 /Alc/effects/reverb.c | |
parent | dc253700637d2154f3103ca627c8d2ac1a7c1ddd (diff) |
Don't do more reverb samples than there are to fade.
This avoids having to clamp the fade value when incrementing it.
Diffstat (limited to 'Alc/effects/reverb.c')
-rw-r--r-- | Alc/effects/reverb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 60ff79b2..6e5144fa 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -1691,7 +1691,7 @@ static ALvoid EarlyReflection_##T(ALreverbState *State, const ALsizei todo, \ f[j]); \ \ offset++; \ - fade = minf(1.0f, fade + FadeStep); \ + fade += FadeStep; \ } \ } DECL_TEMPLATE(Unfaded) @@ -1777,7 +1777,7 @@ static ALvoid LateReverb_##T(ALreverbState *State, const ALsizei todo, \ DelayLineIn(&State->Late.Delay[j], offset, f[j]); \ \ offset++; \ - fade = minf(1.0f, fade + FadeStep); \ + fade += FadeStep; \ } \ } DECL_TEMPLATE(Unfaded) @@ -1901,6 +1901,9 @@ static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, co for(base = 0;base < SamplesToDo;) { ALsizei todo = minu(SamplesToDo-base, MAX_UPDATE_SAMPLES); + /* If cross-fading, don't do more samples than there are to fade. */ + if(FADE_SAMPLES-fadeCount > 0) + todo = mini(todo, FADE_SAMPLES-fadeCount); /* Convert B-Format to A-Format for processing. */ memset(afmt, 0, sizeof(*afmt)*4); @@ -1915,6 +1918,7 @@ static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, co { /* Update the cross-fading delay line taps. */ fadeCount = FADE_SAMPLES; + fade = 1.0f; for(c = 0;c < 4;c++) { State->EarlyDelayTap[c][0] = State->EarlyDelayTap[c][1]; |