aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/chorus.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-12-17 22:10:58 -0800
committerChris Robinson <[email protected]>2017-12-17 22:10:58 -0800
commit04cf832fe601f02255e4bdab3ca34a49e006e7ab (patch)
tree515e71b37941588263296778ebe0b46d6e734302 /Alc/effects/chorus.c
parent2346426b6eaffada27d60dfd6935f04f15aae6cf (diff)
Use the selected mixer for chorus and flanger output
Diffstat (limited to 'Alc/effects/chorus.c')
-rw-r--r--Alc/effects/chorus.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c
index aa62e8b9..bc7b3558 100644
--- a/Alc/effects/chorus.c
+++ b/Alc/effects/chorus.c
@@ -223,15 +223,15 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, c
for(base = 0;base < SamplesToDo;)
{
- const ALsizei todo = mini(128, SamplesToDo-base);
- ALfloat temps[2][128];
- ALsizei offset;
+ const ALsizei todo = mini(256, SamplesToDo-base);
+ ALfloat temps[256];
for(c = 0;c < 2;c++)
{
ALfloat *restrict sampbuf = state->SampleBuffer[c];
ALint disp_offset = state->lfo_disp*c;
- ALint moddelays[128];
+ ALint moddelays[256];
+ ALsizei offset;
if(state->waveform == CWF_Triangle)
GetTriangleDelays(moddelays, (state->lfo_offset+disp_offset)%state->lfo_range,
@@ -249,31 +249,17 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, c
ALfloat mu = (moddelays[i]&FRACTIONMASK) * (1.0f/FRACTIONONE);
sampbuf[offset&bufmask] = SamplesIn[0][base+i];
- temps[c][i] = (sampbuf[(offset-delay) & bufmask]*(1.0f-mu) +
- sampbuf[(offset-(delay+1)) & bufmask]*mu) * feedback;
- sampbuf[offset&bufmask] += temps[c][i];
+ temps[i] = (sampbuf[(offset-delay) & bufmask]*(1.0f-mu) +
+ sampbuf[(offset-(delay+1)) & bufmask]*mu) * feedback;
+ sampbuf[offset&bufmask] += temps[i];
offset++;
}
- }
- state->offset = offset;
- state->lfo_offset = (state->lfo_offset+todo) % state->lfo_range;
- for(c = 0;c < NumChannels;c++)
- {
- ALfloat gain = state->Gain[0][c];
- if(fabsf(gain) > GAIN_SILENCE_THRESHOLD)
- {
- for(i = 0;i < todo;i++)
- SamplesOut[c][i+base] += temps[0][i] * gain;
- }
-
- gain = state->Gain[1][c];
- if(fabsf(gain) > GAIN_SILENCE_THRESHOLD)
- {
- for(i = 0;i < todo;i++)
- SamplesOut[c][i+base] += temps[1][i] * gain;
- }
+ MixSamples(temps, NumChannels, SamplesOut, state->Gain[c], state->Gain[c],
+ 0, base, todo);
}
+ state->offset += todo;
+ state->lfo_offset = (state->lfo_offset+todo) % state->lfo_range;
base += todo;
}