diff options
author | Chris Robinson <[email protected]> | 2014-12-18 09:23:55 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-12-18 09:23:55 -0800 |
commit | c3a36d9b1975df8136c80412cb5ebfde711608d8 (patch) | |
tree | 5d8389b13d81e33bc4dc9c4cb727a31d3e2fd5f3 /Alc | |
parent | 9897fca79407f741c8151a9914b0127d349f4093 (diff) |
Do up to 256 samples at a time with multi-step loops
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/effects/autowah.c | 4 | ||||
-rw-r--r-- | Alc/effects/chorus.c | 4 | ||||
-rw-r--r-- | Alc/effects/compressor.c | 4 | ||||
-rw-r--r-- | Alc/effects/distortion.c | 16 | ||||
-rw-r--r-- | Alc/effects/echo.c | 4 | ||||
-rw-r--r-- | Alc/effects/equalizer.c | 4 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 4 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 4 | ||||
-rw-r--r-- | Alc/mixer.c | 4 |
9 files changed, 23 insertions, 25 deletions
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c index 6f16743d..a444ace3 100644 --- a/Alc/effects/autowah.c +++ b/Alc/effects/autowah.c @@ -85,8 +85,8 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, for(base = 0;base < SamplesToDo;) { - ALfloat temps[64]; - ALuint td = minu(SamplesToDo-base, 64); + ALfloat temps[256]; + ALuint td = minu(256, SamplesToDo-base); ALfloat gain = state->GainCtrl; for(it = 0;it < td;it++) diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 02887fde..aef12647 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -210,8 +210,8 @@ static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, co for(base = 0;base < SamplesToDo;) { - ALfloat temps[64][2]; - ALuint td = minu(SamplesToDo-base, 64); + ALfloat temps[128][2]; + ALuint td = minu(128, SamplesToDo-base); switch(state->waveform) { diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c index f9964427..9859a085 100644 --- a/Alc/effects/compressor.c +++ b/Alc/effects/compressor.c @@ -69,8 +69,8 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples for(base = 0;base < SamplesToDo;) { - ALfloat temps[64]; - ALuint td = minu(SamplesToDo-base, 64); + ALfloat temps[256]; + ALuint td = minu(256, SamplesToDo-base); if(state->Enabled) { diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 7098cdf9..22e05c70 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -87,7 +87,6 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, ALCdevice *Devi static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) { const ALfloat fc = state->edge_coeff; - float oversample_buffer[64][4]; ALuint base; ALuint it; ALuint ot; @@ -95,8 +94,8 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint Samples for(base = 0;base < SamplesToDo;) { - ALfloat temps[64]; - ALuint td = minu(SamplesToDo-base, 64); + float oversample_buffer[64][4]; + ALuint td = minu(64, SamplesToDo-base); /* Perform 4x oversampling to avoid aliasing. */ /* Oversampling greatly improves distortion */ @@ -148,20 +147,19 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint Samples smp = ALfilterState_processSingle(&state->bandpass, smp); oversample_buffer[it][ot] = smp; } - - /* Fourth step, final, do attenuation and perform decimation, */ - /* store only one sample out of 4. */ - temps[it] = oversample_buffer[it][0] * state->attenuation; } for(kt = 0;kt < NumChannels;kt++) { - ALfloat gain = state->Gain[kt]; + /* Fourth step, final, do attenuation and perform decimation, + * store only one sample out of 4. + */ + ALfloat gain = state->Gain[kt] * state->attenuation; if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; for(it = 0;it < td;it++) - SamplesOut[kt][base+it] += gain * temps[it]; + SamplesOut[kt][base+it] += gain * oversample_buffer[it][0]; } base += td; diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c index fd85bdb0..b852a096 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -121,8 +121,8 @@ static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const for(base = 0;base < SamplesToDo;) { - ALfloat temps[64][2]; - ALuint td = minu(SamplesToDo-base, 64); + ALfloat temps[128][2]; + ALuint td = minu(128, SamplesToDo-base); for(i = 0;i < td;i++) { diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c index 7caec266..6a5ed549 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -127,8 +127,8 @@ static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesTo for(base = 0;base < SamplesToDo;) { - ALfloat temps[64]; - ALuint td = minu(SamplesToDo-base, 64); + ALfloat temps[256]; + ALuint td = minu(256, SamplesToDo-base); for(it = 0;it < td;it++) { diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index 460bb866..1af56102 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -210,8 +210,8 @@ static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, for(base = 0;base < SamplesToDo;) { - ALfloat temps[64][2]; - ALuint td = minu(SamplesToDo-base, 64); + ALfloat temps[128][2]; + ALuint td = minu(128, SamplesToDo-base); switch(state->waveform) { diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index 4d183449..d76fddad 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -77,8 +77,8 @@ static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \ \ for(base = 0;base < SamplesToDo;) \ { \ - ALfloat temps[64]; \ - ALuint td = minu(SamplesToDo-base, 64); \ + ALfloat temps[256]; \ + ALuint td = minu(256, SamplesToDo-base); \ ALuint i, k; \ \ for(i = 0;i < td;i++) \ diff --git a/Alc/mixer.c b/Alc/mixer.c index 6a01fadc..3e65ac72 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -188,8 +188,8 @@ static const ALfloat *DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter case AF_BandPass: for(i = 0;i < numsamples;) { - ALfloat temp[64]; - ALuint todo = minu(64, numsamples-i); + ALfloat temp[256]; + ALuint todo = minu(256, numsamples-i); ALfilterState_process(lpfilter, temp, src+i, todo); ALfilterState_process(hpfilter, dst+i, temp, todo); |