diff options
author | Chris Robinson <[email protected]> | 2017-05-26 09:07:27 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-05-26 09:09:35 -0700 |
commit | 653f0a1405b5dbceab6c2d8adc8fa246bdb5f607 (patch) | |
tree | d13ecb71a49fab095e088b22e7b8133731170974 /Alc | |
parent | 2b14c1d62389f3bb8fe52cac9b8d3cc97da0838f (diff) |
Fix handling chorus and flanger LFO displacement offset
The phase offset is modulo-wrapped rather than masked, so it's best to avoid
negative offsets.
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/effects/chorus.c | 5 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 21db73f6..62f2e531 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -165,7 +165,10 @@ static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device } /* Calculate lfo phase displacement */ - state->lfo_disp = fastf2i(state->lfo_range * (phase/360.0f)); + if(phase >= 0) + state->lfo_disp = fastf2i(state->lfo_range * (phase/360.0f)); + else + state->lfo_disp = fastf2i(state->lfo_range * ((360+phase)/360.0f)); } } diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index 5593d549..d330511a 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -165,7 +165,10 @@ static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Devi } /* Calculate lfo phase displacement */ - state->lfo_disp = fastf2i(state->lfo_range * (phase/360.0f)); + if(phase >= 0) + state->lfo_disp = fastf2i(state->lfo_range * (phase/360.0f)); + else + state->lfo_disp = fastf2i(state->lfo_range * ((360+phase)/360.0f)); } } |