diff options
author | Chris Robinson <[email protected]> | 2017-12-17 22:10:58 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-12-17 22:10:58 -0800 |
commit | 04cf832fe601f02255e4bdab3ca34a49e006e7ab (patch) | |
tree | 515e71b37941588263296778ebe0b46d6e734302 /Alc/effects | |
parent | 2346426b6eaffada27d60dfd6935f04f15aae6cf (diff) |
Use the selected mixer for chorus and flanger output
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/chorus.c | 36 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 36 |
2 files changed, 22 insertions, 50 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; } diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index 74a39364..ae54b890 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -222,15 +222,15 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALsizei SamplesToDo, 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 == FWF_Triangle) GetTriangleDelays(moddelays, (state->lfo_offset+disp_offset)%state->lfo_range, @@ -248,31 +248,17 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALsizei SamplesToDo, 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; } |