diff options
author | Chris Robinson <[email protected]> | 2018-05-29 22:55:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-05-29 22:55:21 -0700 |
commit | 0b7f35b28922e2250f06d1aee1ebb60bfecf91d6 (patch) | |
tree | f19535db9bfafe797e3ca899fcdc86261673f1d8 /Alc/effects/modulator.c | |
parent | 46c59f382f5d417a8e95a58a8e2156b9c4b35f1a (diff) |
Avoid extra sample copies and storage in the modulator effect
Diffstat (limited to 'Alc/effects/modulator.c')
-rw-r--r-- | Alc/effects/modulator.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index db771103..7985f03e 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -40,8 +40,6 @@ typedef struct ALmodulatorState { ALsizei index; ALsizei step; - alignas(16) ALfloat ModSamples[MAX_UPDATE_SAMPLES]; - struct { BiquadFilter Filter; @@ -162,13 +160,12 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCcontext static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - ALfloat *restrict modsamples = ASSUME_ALIGNED(state->ModSamples, 16); const ALsizei step = state->step; ALsizei base; for(base = 0;base < SamplesToDo;) { - alignas(16) ALfloat temps[2][MAX_UPDATE_SAMPLES]; + alignas(16) ALfloat modsamples[MAX_UPDATE_SAMPLES]; ALsizei td = mini(MAX_UPDATE_SAMPLES, SamplesToDo-base); ALsizei c, i; @@ -178,11 +175,13 @@ static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesT for(c = 0;c < MAX_EFFECT_CHANNELS;c++) { - BiquadFilter_process(&state->Chans[c].Filter, temps[0], &SamplesIn[c][base], td); + alignas(16) ALfloat temps[MAX_UPDATE_SAMPLES]; + + BiquadFilter_process(&state->Chans[c].Filter, temps, &SamplesIn[c][base], td); for(i = 0;i < td;i++) - temps[1][i] = temps[0][i] * modsamples[i]; + temps[i] *= modsamples[i]; - MixSamples(temps[1], NumChannels, SamplesOut, state->Chans[c].CurrentGains, + MixSamples(temps, NumChannels, SamplesOut, state->Chans[c].CurrentGains, state->Chans[c].TargetGains, SamplesToDo-base, base, td); } |