aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alcModulator.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-05-20 04:16:48 -0700
committerChris Robinson <[email protected]>2013-05-20 04:16:48 -0700
commit5b706f3bdc1a8c8f064a253b53b4e86f9d88da8d (patch)
tree611e350eb0fe6986423e7a0522b6a42af436187c /Alc/alcModulator.c
parent80459b13e45306958f9fa2087ef750f1e736818b (diff)
Process 64 samples at a time for some effects
This should help with the non-interleaved samples of the output, and allow skipping channels that don't contribute to the output.
Diffstat (limited to 'Alc/alcModulator.c')
-rw-r--r--Alc/alcModulator.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/Alc/alcModulator.c b/Alc/alcModulator.c
index d33811ba..c9f1edf4 100644
--- a/Alc/alcModulator.c
+++ b/Alc/alcModulator.c
@@ -88,20 +88,36 @@ static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \
{ \
const ALuint step = state->step; \
ALuint index = state->index; \
- ALfloat samp; \
- ALuint i, k; \
+ ALuint base; \
\
- for(i = 0;i < SamplesToDo;i++) \
+ for(base = 0;base < SamplesToDo;) \
{ \
- samp = SamplesIn[i]; \
- samp = hpFilter1P(&state->iirFilter, 0, samp); \
+ ALfloat temps[64]; \
+ ALuint td = minu(SamplesToDo-base, 64); \
+ ALuint i, k; \
\
- index += step; \
- index &= WAVEFORM_FRACMASK; \
- samp *= func(index); \
+ for(i = 0;i < td;i++) \
+ { \
+ ALfloat samp; \
+ samp = SamplesIn[base+i]; \
+ samp = hpFilter1P(&state->iirFilter, 0, samp); \
+ \
+ index += step; \
+ index &= WAVEFORM_FRACMASK; \
+ temps[i] = samp * func(index); \
+ } \
\
for(k = 0;k < MaxChannels;k++) \
- SamplesOut[k][i] += state->Gain[k] * samp; \
+ { \
+ ALfloat gain = state->Gain[k]; \
+ if(!(gain > 0.00001f)) \
+ continue; \
+ \
+ for(i = 0;i < td;i++) \
+ SamplesOut[k][base+i] += gain * temps[i]; \
+ } \
+ \
+ base += td; \
} \
state->index = index; \
}