54 void setEnabled (
bool newValue)
noexcept { enabled = newValue; }
57 void setMode (Mode newValue)
noexcept;
84 const auto& inputBlock =
context.getInputBlock();
85 auto& outputBlock =
context.getOutputBlock();
86 const auto numChannels = outputBlock.getNumChannels();
87 const auto numSamples = outputBlock.getNumSamples();
90 jassert (inputBlock.getNumChannels() == numChannels);
91 jassert (inputBlock.getNumSamples() == numSamples);
93 if (! enabled ||
context.isBypassed)
95 outputBlock.copyFrom (inputBlock);
99 for (
size_t n = 0; n < numSamples; ++n)
103 for (
size_t ch = 0;
ch < numChannels; ++
ch)
104 outputBlock.getChannelPointer (
ch)[n] = processSample (inputBlock.getChannelPointer (
ch)[n],
ch);
110 Type processSample (Type inputValue,
size_t channelToUse)
noexcept;
111 void updateSmoothers() noexcept;
115 Type drive, drive2, gain, gain2, comp;
117 static constexpr
size_t numStates = 5;
118 std::vector<std::array<Type, numStates>> state;
119 std::array<Type, numStates> A;
121 SmoothedValue<Type> cutoffTransformSmoother, scaledResonanceSmoother;
122 Type cutoffTransformValue, scaledResonanceValue;
124 LookupTableTransform<Type> saturationLUT { [] (Type x) {
return std::tanh (x); }, Type (-5), Type (5), 128 };
126 Type cutoffFreqHz { Type (200) };
129 Type cutoffFreqScaler;
135 void setSampleRate (Type newValue)
noexcept;
136 void setNumChannels (
size_t newValue) { state.resize (newValue); }
137 void updateCutoffFreq() noexcept { cutoffTransformSmoother.
setTargetValue (std::exp (cutoffFreqHz * cutoffFreqScaler)); }
138 void updateResonance() noexcept { scaledResonanceSmoother.
setTargetValue (jmap (resonance, Type (0.1), Type (1.0))); }