From 82c5b741e5c7448eb2649e33505622e42e08794e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 15 Aug 2022 12:56:36 -0700 Subject: Use proper array sizes for more gains --- alc/effects/autowah.cpp | 4 ++-- alc/effects/chorus.cpp | 4 ++-- alc/effects/compressor.cpp | 2 +- alc/effects/dedicated.cpp | 4 ++++ alc/effects/distortion.cpp | 2 +- alc/effects/echo.cpp | 4 ++-- alc/effects/equalizer.cpp | 4 ++-- alc/effects/fshifter.cpp | 4 ++-- alc/effects/modulator.cpp | 4 ++-- alc/effects/pshifter.cpp | 4 ++-- alc/effects/reverb.cpp | 8 ++++---- alc/effects/vmorpher.cpp | 4 ++-- 12 files changed, 26 insertions(+), 22 deletions(-) (limited to 'alc/effects') diff --git a/alc/effects/autowah.cpp b/alc/effects/autowah.cpp index 50c4a5ad..b5e259f4 100644 --- a/alc/effects/autowah.cpp +++ b/alc/effects/autowah.cpp @@ -71,8 +71,8 @@ struct AutowahState final : public EffectState { } Filter; /* Effect gains for each output channel */ - float CurrentGains[MAX_OUTPUT_CHANNELS]; - float TargetGains[MAX_OUTPUT_CHANNELS]; + float CurrentGains[MaxAmbiChannels]; + float TargetGains[MaxAmbiChannels]; } mChans[MaxAmbiChannels]; /* Effects buffers */ diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp index 99a2a68a..c156c74d 100644 --- a/alc/effects/chorus.cpp +++ b/alc/effects/chorus.cpp @@ -61,8 +61,8 @@ struct ChorusState final : public EffectState { /* Gains for left and right sides */ struct { - float Current[MAX_OUTPUT_CHANNELS]{}; - float Target[MAX_OUTPUT_CHANNELS]{}; + float Current[MaxAmbiChannels]{}; + float Target[MaxAmbiChannels]{}; } mGains[2]; /* effect parameters */ diff --git a/alc/effects/compressor.cpp b/alc/effects/compressor.cpp index 366f2275..6202e58e 100644 --- a/alc/effects/compressor.cpp +++ b/alc/effects/compressor.cpp @@ -64,7 +64,7 @@ namespace { struct CompressorState final : public EffectState { /* Effect gains for each channel */ - float mGain[MaxAmbiChannels][MAX_OUTPUT_CHANNELS]{}; + float mGain[MaxAmbiChannels][MaxAmbiChannels]{}; /* Effect parameters */ bool mEnabled{true}; diff --git a/alc/effects/dedicated.cpp b/alc/effects/dedicated.cpp index 434dfc69..4d7a39f0 100644 --- a/alc/effects/dedicated.cpp +++ b/alc/effects/dedicated.cpp @@ -43,6 +43,10 @@ namespace { using uint = unsigned int; struct DedicatedState final : public EffectState { + /* The "dedicated" effect can output to the real output, so should have + * gains for all possible output channels and not just the main ambisonic + * buffer. + */ float mCurrentGains[MAX_OUTPUT_CHANNELS]; float mTargetGains[MAX_OUTPUT_CHANNELS]; diff --git a/alc/effects/distortion.cpp b/alc/effects/distortion.cpp index ed21ef34..dba13beb 100644 --- a/alc/effects/distortion.cpp +++ b/alc/effects/distortion.cpp @@ -45,7 +45,7 @@ namespace { struct DistortionState final : public EffectState { /* Effect gains for each channel */ - float mGain[MAX_OUTPUT_CHANNELS]{}; + float mGain[MaxAmbiChannels]{}; /* Effect parameters */ BiquadFilter mLowpass; diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp index 5d003718..7f9edf82 100644 --- a/alc/effects/echo.cpp +++ b/alc/effects/echo.cpp @@ -60,8 +60,8 @@ struct EchoState final : public EffectState { /* The panning gains for the two taps */ struct { - float Current[MAX_OUTPUT_CHANNELS]{}; - float Target[MAX_OUTPUT_CHANNELS]{}; + float Current[MaxAmbiChannels]{}; + float Target[MaxAmbiChannels]{}; } mGains[2]; BiquadFilter mFilter; diff --git a/alc/effects/equalizer.cpp b/alc/effects/equalizer.cpp index 202c191b..4bce34a2 100644 --- a/alc/effects/equalizer.cpp +++ b/alc/effects/equalizer.cpp @@ -91,8 +91,8 @@ struct EqualizerState final : public EffectState { BiquadFilter filter[4]; /* Effect gains for each channel */ - float CurrentGains[MAX_OUTPUT_CHANNELS]{}; - float TargetGains[MAX_OUTPUT_CHANNELS]{}; + float CurrentGains[MaxAmbiChannels]{}; + float TargetGains[MaxAmbiChannels]{}; } mChans[MaxAmbiChannels]; alignas(16) FloatBufferLine mSampleBuffer{}; diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp index def745c4..bed6c79f 100644 --- a/alc/effects/fshifter.cpp +++ b/alc/effects/fshifter.cpp @@ -89,8 +89,8 @@ struct FshifterState final : public EffectState { /* Effect gains for each output channel */ struct { - float Current[MAX_OUTPUT_CHANNELS]{}; - float Target[MAX_OUTPUT_CHANNELS]{}; + float Current[MaxAmbiChannels]{}; + float Target[MaxAmbiChannels]{}; } mGains[2]; diff --git a/alc/effects/modulator.cpp b/alc/effects/modulator.cpp index 84561f5c..c854f1e9 100644 --- a/alc/effects/modulator.cpp +++ b/alc/effects/modulator.cpp @@ -86,8 +86,8 @@ struct ModulatorState final : public EffectState { struct { BiquadFilter Filter; - float CurrentGains[MAX_OUTPUT_CHANNELS]{}; - float TargetGains[MAX_OUTPUT_CHANNELS]{}; + float CurrentGains[MaxAmbiChannels]{}; + float TargetGains[MaxAmbiChannels]{}; } mChans[MaxAmbiChannels]; diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index aa20c660..fe116222 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -99,8 +99,8 @@ struct PshifterState final : public EffectState { alignas(16) FloatBufferLine mBufferOut; /* Effect gains for each output channel */ - float mCurrentGains[MAX_OUTPUT_CHANNELS]; - float mTargetGains[MAX_OUTPUT_CHANNELS]; + float mCurrentGains[MaxAmbiChannels]; + float mTargetGains[MaxAmbiChannels]; void deviceUpdate(const DeviceBase *device, const Buffer &buffer) override; diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index e9f2e35f..7e90f692 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -340,8 +340,8 @@ struct EarlyReflections { float Coeff[NUM_LINES][2]{}; /* The gain for each output channel based on 3D panning. */ - float CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; - float PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; + float CurrentGain[NUM_LINES][MaxAmbiChannels]{}; + float PanGain[NUM_LINES][MaxAmbiChannels]{}; void updateLines(const float density_mult, const float diffusion, const float decayTime, const float frequency); @@ -384,8 +384,8 @@ struct LateReverb { VecAllpass VecAp; /* The gain for each output channel based on 3D panning. */ - float CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; - float PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]{}; + float CurrentGain[NUM_LINES][MaxAmbiChannels]{}; + float PanGain[NUM_LINES][MaxAmbiChannels]{}; void updateLines(const float density_mult, const float diffusion, const float lfDecayTime, const float mfDecayTime, const float hfDecayTime, const float lf0norm, diff --git a/alc/effects/vmorpher.cpp b/alc/effects/vmorpher.cpp index edc50eb1..9834c335 100644 --- a/alc/effects/vmorpher.cpp +++ b/alc/effects/vmorpher.cpp @@ -147,8 +147,8 @@ struct VmorpherState final : public EffectState { FormantFilter Formants[NUM_FILTERS][NUM_FORMANTS]; /* Effect gains for each channel */ - float CurrentGains[MAX_OUTPUT_CHANNELS]{}; - float TargetGains[MAX_OUTPUT_CHANNELS]{}; + float CurrentGains[MaxAmbiChannels]{}; + float TargetGains[MaxAmbiChannels]{}; } mChans[MaxAmbiChannels]; void (*mGetSamples)(float*RESTRICT, uint, const uint, size_t){}; -- cgit v1.2.3