aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-12-19 15:12:06 -0800
committerChris Robinson <[email protected]>2017-12-19 15:12:06 -0800
commit1a911be6176166498ba13ec6c84883f4b9526edd (patch)
tree9235badc3202f2c128fed6ff68c1d38e9a30f4b9 /Alc/effects
parenta0565dc9bb2f943d894dd550f8bcb62079cc3d48 (diff)
Update the chorus and flanger state struct less often
Diffstat (limited to 'Alc/effects')
-rw-r--r--Alc/effects/chorus.c8
-rw-r--r--Alc/effects/flanger.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c
index 25fa81ba..850108cf 100644
--- a/Alc/effects/chorus.c
+++ b/Alc/effects/chorus.c
@@ -217,6 +217,7 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, c
const ALsizei avgdelay = (state->delay+fastf2i(state->depth) + (FRACTIONONE>>1)) >>
FRACTIONBITS;
ALfloat *restrict delaybuf = state->SampleBuffer;
+ ALsizei offset = state->offset;
ALsizei i, c;
ALsizei base;
@@ -225,7 +226,6 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, c
const ALsizei todo = mini(256, SamplesToDo-base);
ALint moddelays[2][256];
ALfloat temps[2][256];
- ALsizei offset;
if(state->waveform == CWF_Triangle)
{
@@ -243,8 +243,8 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, c
state->lfo_range, state->lfo_scale, state->depth, state->delay,
todo);
}
+ state->lfo_offset = (state->lfo_offset+todo) % state->lfo_range;
- offset = state->offset;
for(i = 0;i < todo;i++)
{
ALint delay;
@@ -269,8 +269,6 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, c
delaybuf[offset&bufmask] += delaybuf[(offset-avgdelay) & bufmask] * feedback;
offset++;
}
- state->offset += todo;
- state->lfo_offset = (state->lfo_offset+todo) % state->lfo_range;
for(c = 0;c < 2;c++)
MixSamples(temps[c], NumChannels, SamplesOut, state->Gains[c].Current,
@@ -278,6 +276,8 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, c
base += todo;
}
+
+ state->offset = offset;
}
diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c
index 75b72dec..45a3e32c 100644
--- a/Alc/effects/flanger.c
+++ b/Alc/effects/flanger.c
@@ -216,6 +216,7 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALsizei SamplesToDo,
const ALsizei avgdelay = (state->delay+fastf2i(state->depth) + (FRACTIONONE>>1)) >>
FRACTIONBITS;
ALfloat *restrict delaybuf = state->SampleBuffer;
+ ALsizei offset = state->offset;
ALsizei i, c;
ALsizei base;
@@ -224,7 +225,6 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALsizei SamplesToDo,
const ALsizei todo = mini(256, SamplesToDo-base);
ALint moddelays[2][256];
ALfloat temps[2][256];
- ALsizei offset;
if(state->waveform == FWF_Triangle)
{
@@ -242,8 +242,8 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALsizei SamplesToDo,
state->lfo_range, state->lfo_scale, state->depth, state->delay,
todo);
}
+ state->lfo_offset = (state->lfo_offset+todo) % state->lfo_range;
- offset = state->offset;
for(i = 0;i < todo;i++)
{
ALint delay;
@@ -268,8 +268,6 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALsizei SamplesToDo,
delaybuf[offset&bufmask] += delaybuf[(offset-avgdelay) & bufmask] * feedback;
offset++;
}
- state->offset += todo;
- state->lfo_offset = (state->lfo_offset+todo) % state->lfo_range;
for(c = 0;c < 2;c++)
MixSamples(temps[c], NumChannels, SamplesOut, state->Gains[c].Current,
@@ -277,6 +275,8 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALsizei SamplesToDo,
base += todo;
}
+
+ state->offset = offset;
}