Use proper array sizes for more gains

master
Chris Robinson 2022-08-15 12:56:36 -07:00
parent f9e6fbaeff
commit 82c5b741e5
15 changed files with 30 additions and 26 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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};

View File

@ -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];

View File

@ -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;

View File

@ -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;

View File

@ -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{};

View File

@ -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];

View File

@ -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];

View File

@ -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;

View File

@ -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,

View File

@ -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){};

View File

@ -114,7 +114,7 @@ std::array<float,MaxAmbiChannels> CalcAmbiCoeffs(const float y, const float z, c
}
void ComputePanGains(const MixParams *mix, const float*RESTRICT coeffs, const float ingain,
const al::span<float,MAX_OUTPUT_CHANNELS> gains)
const al::span<float,MaxAmbiChannels> gains)
{
auto ambimap = mix->AmbiMap.cbegin();

View File

@ -78,7 +78,7 @@ inline std::array<float,MaxAmbiChannels> CalcAngleCoeffs(const float azimuth,
* scale and orient the sound samples.
*/
void ComputePanGains(const MixParams *mix, const float*RESTRICT coeffs, const float ingain,
const al::span<float,MAX_OUTPUT_CHANNELS> gains);
const al::span<float,MaxAmbiChannels> gains);
/** Helper to set an identity/pass-through panning for ambisonic mixing (3D input). */

View File

@ -85,8 +85,8 @@ struct SendParams {
BiquadFilter HighPass;
struct {
std::array<float,MAX_OUTPUT_CHANNELS> Current;
std::array<float,MAX_OUTPUT_CHANNELS> Target;
std::array<float,MaxAmbiChannels> Current;
std::array<float,MaxAmbiChannels> Target;
} Gains;
};