diff options
author | Chris Robinson <[email protected]> | 2018-03-04 22:26:30 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-03-08 17:48:21 -0800 |
commit | 22d3e3b5639ac1de8e35a9be1dd82745ca3ddc23 (patch) | |
tree | 61f2c054094708150c77fbae2c075aad24d5b217 | |
parent | 4e613c5d4b83e40d22acdf816cd41d911e6052aa (diff) |
Simplify modulator effect index updating
-rw-r--r-- | Alc/effects/modulator.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index 74a0d0c5..a7c4ce36 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -135,7 +135,7 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCcontext state->step = fastf2i(props->Modulator.Frequency*WAVEFORM_FRACONE / device->Frequency); - if(state->step == 0) state->step = 1; + state->step = clampi(state->step, 1, WAVEFORM_FRACONE-1); /* Custom filter coeffs, which match the old version instead of a low-shelf. */ cw = cosf(F_TAU * props->Modulator.HighPassCutoff / device->Frequency); @@ -177,8 +177,7 @@ static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesT state->Chans[i].TargetGains, SamplesToDo-base, base, td); } - for(i = 0;i < td;i++) - index += step; + index += (step*td) & WAVEFORM_FRACMASK; index &= WAVEFORM_FRACMASK; base += td; } |