aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/modulator.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-02-21 03:52:54 -0800
committerChris Robinson <[email protected]>2019-02-21 03:52:54 -0800
commit8d2d7c63da8f5f106f607f5b21ea08151217c58a (patch)
treeff5e35dff1279614ba9211f1381f47b789d42a3e /Alc/effects/modulator.cpp
parent462e320847de3937a5b40a4ed22e3bd745360410 (diff)
Get rid of the MAX_EFFECT_CHANNELS macro
Diffstat (limited to 'Alc/effects/modulator.cpp')
-rw-r--r--Alc/effects/modulator.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Alc/effects/modulator.cpp b/Alc/effects/modulator.cpp
index 62d5a7ad..5786b708 100644
--- a/Alc/effects/modulator.cpp
+++ b/Alc/effects/modulator.cpp
@@ -85,7 +85,7 @@ struct ALmodulatorState final : public EffectState {
ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]{};
ALfloat TargetGains[MAX_OUTPUT_CHANNELS]{};
- } mChans[MAX_EFFECT_CHANNELS];
+ } mChans[MAX_AMBI_CHANNELS];
ALboolean deviceUpdate(const ALCdevice *device) override;
@@ -107,9 +107,7 @@ ALboolean ALmodulatorState::deviceUpdate(const ALCdevice *UNUSED(device))
void ALmodulatorState::update(const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props, const EffectTarget target)
{
- const ALCdevice *device = context->Device;
- ALfloat f0norm;
- ALsizei i;
+ const ALCdevice *device{context->Device};
mStep = fastf2i(props->Modulator.Frequency / static_cast<ALfloat>(device->Frequency) * WAVEFORM_FRACONE);
mStep = clampi(mStep, 0, WAVEFORM_FRACONE-1);
@@ -123,19 +121,21 @@ void ALmodulatorState::update(const ALCcontext *context, const ALeffectslot *slo
else /*if(Slot->Params.EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SQUARE)*/
mGetSamples = Modulate<Square>;
- f0norm = props->Modulator.HighPassCutoff / static_cast<ALfloat>(device->Frequency);
+ ALfloat f0norm{props->Modulator.HighPassCutoff / static_cast<ALfloat>(device->Frequency)};
f0norm = clampf(f0norm, 1.0f/512.0f, 0.49f);
/* Bandwidth value is constant in octaves. */
mChans[0].Filter.setParams(BiquadType::HighPass, 1.0f, f0norm,
calc_rcpQ_from_bandwidth(f0norm, 0.75f));
- for(i = 1;i < MAX_EFFECT_CHANNELS;i++)
+ for(size_t i{1u};i < slot->WetBuffer.size();++i)
mChans[i].Filter.copyParamsFrom(mChans[0].Filter);
mOutBuffer = target.FOAOut->Buffer;
mOutChannels = target.FOAOut->NumChannels;
- for(i = 0;i < MAX_EFFECT_CHANNELS;i++)
- ComputePanGains(target.FOAOut, alu::Matrix::Identity()[i].data(), slot->Params.Gain,
- mChans[i].TargetGains);
+ for(size_t i{0u};i < slot->WetBuffer.size();++i)
+ {
+ auto coeffs = GetAmbiIdentityRow(i);
+ ComputePanGains(target.FOAOut, coeffs.data(), slot->Params.Gain, mChans[i].TargetGains);
+ }
}
void ALmodulatorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesIn)[BUFFERSIZE], const ALsizei numInput, ALfloat (*RESTRICT samplesOut)[BUFFERSIZE], const ALsizei numOutput)