diff --git a/core/Mixer.cpp b/core/Mixer.cpp index 6d4d691..ab55cd9 100644 --- a/core/Mixer.cpp +++ b/core/Mixer.cpp @@ -37,7 +37,9 @@ void Mixer::mixChannels(const float **inputs, float *out, template void Mixer::setInputGain(uint32_t index, float gain) { - gains_[index] = gain; + if (isValidInputIndex(index)) { + gains_[index] = gain; + } } template @@ -54,6 +56,8 @@ template bool Mixer::getNormalise() const { } template -bool Mixer::isValidInputIndex(float index) const { - return index >= 0 && index < NumInputs; -} \ No newline at end of file +bool Mixer::isValidInputIndex(uint32_t index) const { + return index < NumInputs; +} + +template class Mixer<2u>; \ No newline at end of file diff --git a/core/Mixer.hpp b/core/Mixer.hpp index c9fccdd..7b3a19e 100644 --- a/core/Mixer.hpp +++ b/core/Mixer.hpp @@ -19,11 +19,9 @@ public: private: void mixChannels(const float **inputs, float *out, uint32_t frames); - bool isValidInputIndex(float index) const; + bool isValidInputIndex(uint32_t index) const; float gains_[NumInputs]; bool normalise_; }; -#endif // MIXER_HPP_INCLUDED - -template class Mixer<2u>; \ No newline at end of file +#endif // MIXER_HPP_INCLUDED \ No newline at end of file diff --git a/plugins/SquidgeDistortion/DistrhoPluginInfo.h b/plugins/SquidgeDistortion/DistrhoPluginInfo.h index 9631a1f..627f348 100644 --- a/plugins/SquidgeDistortion/DistrhoPluginInfo.h +++ b/plugins/SquidgeDistortion/DistrhoPluginInfo.h @@ -9,7 +9,7 @@ #define DISTRHO_PLUGIN_NUM_INPUTS 2 #define DISTRHO_PLUGIN_NUM_OUTPUTS 2 -#define DISTRHO_PLUGIN_NUM_PARAMETERS 2 +#define DISTRHO_PLUGIN_NUM_PARAMETERS 5 #define DISTRHO_PLUGIN_WANT_PROGRAMS 0 #define DISTRHO_PLUGIN_WANT_STATE 0 diff --git a/plugins/SquidgeDistortion/SquidgeDistortion.cpp b/plugins/SquidgeDistortion/SquidgeDistortion.cpp index 117c878..4cf4ab5 100644 --- a/plugins/SquidgeDistortion/SquidgeDistortion.cpp +++ b/plugins/SquidgeDistortion/SquidgeDistortion.cpp @@ -2,6 +2,8 @@ #include "DistrhoPlugin.hpp" #include "DistrhoPluginInfo.h" +#include + #include "../../core/Clipper.hpp" #include "../../core/Filter.hpp" #include "../../core/Gain.hpp" @@ -121,7 +123,9 @@ protected: gain_.setGain(value); break; case kParamClipMode: - clipper_.setMode((Clipper::ClipperMode)value); + value = std::fmin(std::fmax(value, 0.0f), + static_cast(Clipper::kClipperModeCount - 1)); + clipper_.setMode(static_cast(std::lround(value))); break; case kParamFilter: filter_.setCutOff(value);