diff options
author | Chris Robinson <[email protected]> | 2011-11-01 17:12:56 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-11-01 17:12:56 -0700 |
commit | 5eebe73f797d0380305d2bc3aa20d1915b42f869 (patch) | |
tree | 3bfe9f8cce9be623365193b9c4e0fbcfb0b22dc1 /Alc/alcModulator.c | |
parent | 21d400e3c63b8ef45829e13417493c47b774a638 (diff) |
Use a loop to write the modulator effect output
Diffstat (limited to 'Alc/alcModulator.c')
-rw-r--r-- | Alc/alcModulator.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Alc/alcModulator.c b/Alc/alcModulator.c index d955f103..328e1678 100644 --- a/Alc/alcModulator.c +++ b/Alc/alcModulator.c @@ -89,7 +89,7 @@ static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \ const ALuint step = state->step; \ ALuint index = state->index; \ ALfloat samp; \ - ALuint i; \ + ALuint i, k; \ \ for(i = 0;i < SamplesToDo;i++) \ { \ @@ -101,14 +101,8 @@ static void Process##func(ALmodulatorState *state, ALuint SamplesToDo, \ \ samp = hpFilter1P(&state->iirFilter, 0, samp); \ \ - SamplesOut[i][FRONT_LEFT] += state->Gain[FRONT_LEFT] * samp; \ - SamplesOut[i][FRONT_RIGHT] += state->Gain[FRONT_RIGHT] * samp; \ - SamplesOut[i][FRONT_CENTER] += state->Gain[FRONT_CENTER] * samp; \ - SamplesOut[i][SIDE_LEFT] += state->Gain[SIDE_LEFT] * samp; \ - SamplesOut[i][SIDE_RIGHT] += state->Gain[SIDE_RIGHT] * samp; \ - SamplesOut[i][BACK_LEFT] += state->Gain[BACK_LEFT] * samp; \ - SamplesOut[i][BACK_RIGHT] += state->Gain[BACK_RIGHT] * samp; \ - SamplesOut[i][BACK_CENTER] += state->Gain[BACK_CENTER] * samp; \ + for(k = 0;k < MAXCHANNELS;k++) \ + SamplesOut[i][k] += state->Gain[k] * samp; \ } \ state->index = index; \ } @@ -156,7 +150,8 @@ static ALvoid ModulatorUpdate(ALeffectState *effect, ALCcontext *Context, const a = (2.0f-cw) - aluSqrt(aluPow(2.0f-cw, 2.0f) - 1.0f); state->iirFilter.coeff = a; - gain = Slot->Gain; + gain = aluSqrt(1.0f/Device->NumChan); + gain *= Slot->Gain; for(index = 0;index < MAXCHANNELS;index++) state->Gain[index] = 0.0f; for(index = 0;index < Device->NumChan;index++) |