aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/modulator.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-11-07 03:43:33 -0800
committerChris Robinson <[email protected]>2014-11-07 03:43:33 -0800
commit3f7cb8392ea8b75754e5292f75fdfe50168ffc8e (patch)
tree16835b1c968d401684e4c73a9eeb386d5df89cfb /Alc/effects/modulator.c
parent713e9dd4cc5f0bbe396fae35282ec147a45a0974 (diff)
Pas the output device channel count to ALeffectState::process
Diffstat (limited to 'Alc/effects/modulator.c')
-rw-r--r--Alc/effects/modulator.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c
index c69a8a09..4d183449 100644
--- a/Alc/effects/modulator.c
+++ b/Alc/effects/modulator.c
@@ -69,7 +69,7 @@ static inline ALfloat Square(ALuint index)
#define DECL_TEMPLATE(func) \
static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \
const ALfloat *restrict SamplesIn, \
- ALfloat (*restrict SamplesOut)[BUFFERSIZE]) \
+ ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) \
{ \
const ALuint step = state->step; \
ALuint index = state->index; \
@@ -92,10 +92,10 @@ static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \
temps[i] = samp * func(index); \
} \
\
- for(k = 0;k < MAX_OUTPUT_CHANNELS;k++) \
+ for(k = 0;k < NumChannels;k++) \
{ \
ALfloat gain = state->Gain[k]; \
- if(!(gain > GAIN_SILENCE_THRESHOLD)) \
+ if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) \
continue; \
\
for(i = 0;i < td;i++) \
@@ -152,20 +152,20 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, ALCdevice *Device
ComputeAmbientGains(Device, Slot->Gain, state->Gain);
}
-static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE])
+static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat *restrict SamplesIn, ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels)
{
switch(state->Waveform)
{
case SINUSOID:
- ProcessSin(state, SamplesToDo, SamplesIn, SamplesOut);
+ ProcessSin(state, SamplesToDo, SamplesIn, SamplesOut, NumChannels);
break;
case SAWTOOTH:
- ProcessSaw(state, SamplesToDo, SamplesIn, SamplesOut);
+ ProcessSaw(state, SamplesToDo, SamplesIn, SamplesOut, NumChannels);
break;
case SQUARE:
- ProcessSquare(state, SamplesToDo, SamplesIn, SamplesOut);
+ ProcessSquare(state, SamplesToDo, SamplesIn, SamplesOut, NumChannels);
break;
}
}