diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 1f9bec1..25449fe 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -17,6 +17,7 @@ target_link_libraries(juce_plugin_modules PRIVATE juce::juce_audio_utils juce::juce_dsp + chowdsp::chowdsp_logging chowdsp::chowdsp_plugin_base chowdsp::chowdsp_plugin_state chowdsp::chowdsp_plugin_utils diff --git a/modules/chowdsp_utils b/modules/chowdsp_utils index eda8931..a1fe2e8 160000 --- a/modules/chowdsp_utils +++ b/modules/chowdsp_utils @@ -1 +1 @@ -Subproject commit eda8931719dde558bed10f4010fb3e5b2c67ec71 +Subproject commit a1fe2e8a45327edf6367d103c6bd19f0c058a911 diff --git a/src/dsp/AnalogEQ/PultecEQWDF.cpp b/src/dsp/AnalogEQ/PultecEQWDF.cpp index 27355c8..6a73760 100644 --- a/src/dsp/AnalogEQ/PultecEQWDF.cpp +++ b/src/dsp/AnalogEQ/PultecEQWDF.cpp @@ -45,7 +45,7 @@ void PultecEqWDF::setParameters (float treble_boost, float treble_boost_q, float // see sim/pultec_treble_boost_freq_curve_fit.py static constexpr auto A_r = gcem::sqrt (1.0e7f); - const auto g_val = chowdsp::Polynomials::estrin<3> ({ -4.96665892e-17f, 1.73050404e-12f, -2.05889893e-08f, 9.75043069e-05f }, treble_boost_freq); + const auto g_val = chowdsp::Polynomials::estrin<3> (chowdsp::Polynomial { { -4.96665892e-17f, 1.73050404e-12f, -2.05889893e-08f, 9.75043069e-05f } }, treble_boost_freq); const auto treble_boost_cap_val = g_val / A_r; const auto treble_boost_ind_val = chowdsp::Power::ipow<2> (A_r) * treble_boost_cap_val; C_treble_boost.setCapacitanceValue (treble_boost_cap_val); diff --git a/src/dsp/Brickwall/BrickwallProcessor.cpp b/src/dsp/Brickwall/BrickwallProcessor.cpp index 0cd38d8..c57f68e 100644 --- a/src/dsp/Brickwall/BrickwallProcessor.cpp +++ b/src/dsp/Brickwall/BrickwallProcessor.cpp @@ -7,6 +7,12 @@ void BrickwallProcessor::prepare (const juce::dsp::ProcessSpec& spec) filter.prepare (spec); filter.setQValue (chowdsp::CoefficientCalculators::butterworthQ); postSpectrumAnalyserTask.prepareToPlay (spec.sampleRate, (int) spec.maximumBlockSize, (int) spec.numChannels); + + const auto paddedChannelSize = chowdsp::Math::round_to_next_multiple (static_cast (spec.maximumBlockSize), + chowdsp::SIMDUtils::defaultSIMDAlignment); + const auto requiredMemoryBytes = paddedChannelSize * sizeof (float) * 3 // per-band smoothed values + + paddedChannelSize * spec.numChannels * sizeof (float); // per-band fade buffers + arena.reset (requiredMemoryBytes + 32); } void BrickwallProcessor::reset() @@ -20,7 +26,7 @@ void BrickwallProcessor::processBlock (const chowdsp::BufferView& buffer) { filter.setFilterType (getFilterTypeIndex()); filter.setCutoffFrequency (*params.cutoff); - filter.processBlock (buffer); + filter.processBlock (buffer, arena); if (extraState.isEditorOpen.load() && extraState.showSpectrum.get()) postSpectrumAnalyserTask.processBlockInput (buffer.toAudioBuffer()); diff --git a/src/dsp/Brickwall/BrickwallProcessor.h b/src/dsp/Brickwall/BrickwallProcessor.h index 02d9f7f..2d9b7d6 100644 --- a/src/dsp/Brickwall/BrickwallProcessor.h +++ b/src/dsp/Brickwall/BrickwallProcessor.h @@ -178,6 +178,8 @@ class BrickwallProcessor chowdsp::EllipticFilter<16, chowdsp::EllipticFilterType::Highpass>>; EQBand filter; + chowdsp::ArenaAllocator<> arena; + gui::SpectrumAnalyserTask postSpectrumAnalyserTask; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BrickwallProcessor) diff --git a/src/dsp/Waveshaper/SignalSmithWaveshaper.cpp b/src/dsp/Waveshaper/SignalSmithWaveshaper.cpp index baccb6e..e28bc2c 100644 --- a/src/dsp/Waveshaper/SignalSmithWaveshaper.cpp +++ b/src/dsp/Waveshaper/SignalSmithWaveshaper.cpp @@ -41,6 +41,9 @@ static constexpr auto TOL = chowdsp::ScientificRatio<1, -2>::value; void SignalSmithWaveshaper::prepare (double sample_rate, int block_size, int numChannels) { + if (sample_rate == 0.0) + return; + k_smooth.prepare (sample_rate, block_size); k_smooth.setRampLength (0.05); M_smooth.prepare (sample_rate, block_size); diff --git a/src/dsp/Waveshaper/SplineWaveshaper.cpp b/src/dsp/Waveshaper/SplineWaveshaper.cpp index 0d35362..1ed680e 100644 --- a/src/dsp/Waveshaper/SplineWaveshaper.cpp +++ b/src/dsp/Waveshaper/SplineWaveshaper.cpp @@ -39,7 +39,7 @@ double evaluateSpline (const Spline& spline, double x) const auto splineSetIndex = juce::truncatePositiveToUnsignedInt (scaler * x + offset); const auto& ss = spline[splineSetIndex]; - return chowdsp::Polynomials::estrin<3> ({ ss.d, ss.c, ss.b, ss.a }, x - ss.x); + return chowdsp::Polynomials::estrin<3> (chowdsp::Polynomial { { ss.d, ss.c, ss.b, ss.a } }, x - ss.x); } // ADAA reference: https://www.desmos.com/calculator/o36ytu5rro @@ -135,7 +135,7 @@ double evaluateSpline (const VectorSpline& spline, double x) } const auto& ss = spline[splineSetIndex]; - return chowdsp::Polynomials::estrin<3> ({ ss.d, ss.c, ss.b, ss.a }, x - ss.x); + return chowdsp::Polynomials::estrin<3> (chowdsp::Polynomial { { ss.d, ss.c, ss.b, ss.a } }, x - ss.x); } double evaluateSplineADAA (const std::vector& spline, double x) diff --git a/src/gui/AnalogEQ/AnalogEQPlot.cpp b/src/gui/AnalogEQ/AnalogEQPlot.cpp index 444d80f..aaa55f9 100644 --- a/src/gui/AnalogEQ/AnalogEQPlot.cpp +++ b/src/gui/AnalogEQ/AnalogEQPlot.cpp @@ -19,7 +19,9 @@ namespace { using SpectrumDotSlider::SpectrumDotSlider; bool isSelected = false; - AnalogEQPlot::BandID bandID = AnalogEQPlot::BandID::None; + BandID bandID = BandID::None; + juce::dsp::FixedSizeFunction<16, void()> callback; + void paint (juce::Graphics& g) override { SpectrumDotSlider::paint (g); @@ -30,6 +32,12 @@ namespace g.drawEllipse (getThumbBounds().expanded (2.0f), 1.0f); } } + + void mouseDown (const juce::MouseEvent& event) override + { + callback(); + SpectrumDotSlider::mouseDown (event); + } }; template @@ -40,6 +48,44 @@ namespace } } // namespace +AnalogEQPlot::BackgroundPlotter::BackgroundPlotter (chowdsp::SpectrumPlotBase& plotBase, juce::Component& parentComponent) + : parent (parentComponent), + filterPlotter (plotBase, chowdsp::GenericFilterPlotter::Params { + .sampleRate = sampleRate, + .freqSmoothOctaves = 1.0f / 12.0f, + .fftOrder = fftOrder, + }) +{ +} + +AnalogEQPlot::BackgroundPlotter::~BackgroundPlotter() +{ + sharedTimeSliceThread->removeTimeSliceClient (this); + if (sharedTimeSliceThread->getNumClients() == 0) + sharedTimeSliceThread->stopThread (-1); +} + +void AnalogEQPlot::BackgroundPlotter::start() +{ + useTimeSlice(); + sharedTimeSliceThread->addTimeSliceClient (this); + if (! sharedTimeSliceThread->isThreadRunning()) + sharedTimeSliceThread->startThread(); +} + +int AnalogEQPlot::BackgroundPlotter::useTimeSlice() +{ + if (chowdsp::AtomicHelpers::compareNegate (needsUpdate)) + { + filterPlotter.updateFilterPlot(); + + juce::MessageManagerLock mml {}; + parent.repaint(); + } + + return 30; +} + AnalogEQPlot::AnalogEQPlot (State& pluginState, dsp::analog_eq::Params& pultecParams, dsp::analog_eq::ExtraState& analogEqExtraState, @@ -50,11 +96,7 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, .maxFrequencyHz = (float) maxFrequency, .minMagnitudeDB = -21.0f, .maxMagnitudeDB = 21.0f }), - filterPlotter (*this, chowdsp::GenericFilterPlotter::Params { - .sampleRate = sampleRate, - .freqSmoothOctaves = 1.0f / 12.0f, - .fftOrder = fftOrder, - }), + plotter (*this, *this), extraState (analogEqExtraState), pultecEQ (pultecParams, extraState), chyron (pluginState, *pluginState.params.analogEQParams, hcp), @@ -82,13 +124,14 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, }; pultecEQ.prepare ({ sampleRate, (uint32_t) blockSize, 1 }); - filterPlotter.runFilterCallback = [this] (const float* input, float* output, int numSamples) + plotter.filterPlotter.runFilterCallback = [this] (const float* input, float* output, int numSamples) { pultecEQ.reset(); juce::FloatVectorOperations::multiply (output, input, 0.1f, numSamples); pultecEQ.processBlock (chowdsp::BufferView { output, numSamples }); juce::FloatVectorOperations::multiply (output, output, 10.0f, numSamples); }; + plotter.start(); pultecParams.doForAllParameters ( [this, &pluginState] (juce::RangedAudioParameter& param, size_t) @@ -103,23 +146,6 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, }; }); - callbacks += { - pluginState.addParameterListener (*pultecParams.bassFreqParam, chowdsp::ParameterListenerThread::MessageThread, [this] - { setSelectedBand (BandID::Low); }), - pluginState.addParameterListener (*pultecParams.bassBoostParam, chowdsp::ParameterListenerThread::MessageThread, [this] - { setSelectedBand (BandID::Low); }), - pluginState.addParameterListener (*pultecParams.bassCutParam, chowdsp::ParameterListenerThread::MessageThread, [this] - { setSelectedBand (BandID::Low); }), - pluginState.addParameterListener (*pultecParams.trebleCutFreqParam, chowdsp::ParameterListenerThread::MessageThread, [this] - { setSelectedBand (BandID::High_Cut); }), - pluginState.addParameterListener (*pultecParams.trebleCutParam, chowdsp::ParameterListenerThread::MessageThread, [this] - { setSelectedBand (BandID::High_Cut); }), - pluginState.addParameterListener (*pultecParams.trebleBoostFreqParam, chowdsp::ParameterListenerThread::MessageThread, [this] - { setSelectedBand (BandID::High_Boost); }), - pluginState.addParameterListener (*pultecParams.trebleBoostParam, chowdsp::ParameterListenerThread::MessageThread, [this] - { setSelectedBand (BandID::High_Boost); }), - }; - plotPainter.painter = [this] (juce::Graphics& g) { drawMagnitudeLabels (g, *this, { -20.0f, -15.0f, -10.0f, -5.0f, 0.0f, 5.0f, 10.0f, 15.0f, 20.0f }); @@ -129,11 +155,19 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, gui::drawMagnitudeLines (*this, g, { -20.0f, -15.0f, -10.0f, -5.0f, 5.0f, 10.0f, 15.0f, 20.0f }, { 0.0f }, colours::majorLinesColour, colours::minorLinesColour); g.setColour (juce::Colours::red); - g.strokePath (filterPlotter.getPath(), juce::PathStrokeType { 1.5f }); + const juce::ScopedLock pathLock { plotter.filterPlotter.pathMutex }; + g.strokePath (plotter.filterPlotter.getPath(), juce::PathStrokeType { 1.5f }); }; plotPainter.setInterceptsMouseClicks (false, false); addAndMakeVisible (plotPainter); + const auto setBandID = [this] (SelectableDotSlider& slider, BandID id) + { + slider.bandID = id; + slider.callback = [this, id] + { setSelectedBand (id); }; + }; + auto& lfControl = make_unique_component (lowFreqControl, *pultecParams.bassFreqParam, pluginState, @@ -153,7 +187,7 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, &hcp); lbControl.setColour (juce::Slider::thumbColourId, juce::Colours::goldenrod); lbControl.widthProportion = thumbSizeFactor; - lbControl.bandID = BandID::Low; + setBandID (lbControl, BandID::Low); lbControl.getXCoordinate = [this, &bassFreqParam = *pultecParams.bassFreqParam] { return getXCoordinateForFrequency (bassFreqParam.get() * 0.7f); @@ -168,7 +202,7 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, &hcp); lcControl.setColour (juce::Slider::thumbColourId, juce::Colours::goldenrod); lcControl.widthProportion = thumbSizeFactor; - lcControl.bandID = BandID::Low; + setBandID (lcControl, BandID::Low); lcControl.getXCoordinate = [this, &bassFreqParam = *pultecParams.bassFreqParam] { return getXCoordinateForFrequency (bassFreqParam.get() * 1.0f / 0.7f); @@ -182,7 +216,7 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, gui::SpectrumDotSlider::MagnitudeOriented); highBoostGain.setColour (juce::Slider::thumbColourId, juce::Colours::teal); highBoostGain.widthProportion = thumbSizeFactor; - highBoostGain.bandID = BandID::High_Boost; + setBandID (highBoostGain, BandID::High_Boost); highBoostGain.getXCoordinate = [this, &trebleBoostFreqParam = *pultecParams.trebleBoostFreqParam] { return getXCoordinateForFrequency (trebleBoostFreqParam.get()); @@ -196,7 +230,7 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, gui::SpectrumDotSlider::FrequencyOriented); highBoostFreq.setColour (juce::Slider::thumbColourId, juce::Colours::teal); highBoostFreq.widthProportion = thumbSizeFactor; - highBoostFreq.bandID = BandID::High_Boost; + setBandID (highBoostFreq, BandID::High_Boost); highBoostFreq.getYCoordinate = [this, &trebleBoostParam = *pultecParams.trebleBoostParam] { return getYCoordinateForDecibels (trebleBoostParam.get()); @@ -215,7 +249,7 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, gui::SpectrumDotSlider::MagnitudeOriented); highCutGain.setColour (juce::Slider::thumbColourId, juce::Colours::limegreen); highCutGain.widthProportion = thumbSizeFactor; - highCutGain.bandID = BandID::High_Cut; + setBandID (highCutGain, BandID::High_Cut); highCutGain.getXCoordinate = [this, &trebleCutFreqParam = *pultecParams.trebleCutFreqParam] { return getXCoordinateForFrequency (trebleCutFreqParam.get()); @@ -229,7 +263,7 @@ AnalogEQPlot::AnalogEQPlot (State& pluginState, gui::SpectrumDotSlider::FrequencyOriented); highCutFreq.setColour (juce::Slider::thumbColourId, juce::Colours::limegreen); highCutFreq.widthProportion = thumbSizeFactor; - highCutFreq.bandID = BandID::High_Cut; + setBandID (highCutFreq, BandID::High_Cut); highCutFreq.getYCoordinate = [this, &trebleCutParam = *pultecParams.trebleCutParam] { return getYCoordinateForDecibels (trebleCutParam.get()); @@ -256,12 +290,12 @@ AnalogEQPlot::~AnalogEQPlot() void AnalogEQPlot::updatePlot() { - filterPlotter.updateFilterPlot(); - repaint(); + plotter.needsUpdate.store (true, std::memory_order_release); } void AnalogEQPlot::setSelectedBand (BandID band) { + chyron.setSelectedBand (band); for (juce::Slider* slider : { lowFreqControl.get(), lowBoostControl.get(), lowCutControl.get(), @@ -299,7 +333,7 @@ void AnalogEQPlot::resized() void AnalogEQPlot::mouseDown (const juce::MouseEvent& event) { - chyron.setSelectedBand (EQBand::None); + setSelectedBand (BandID::None); if (event.mods.isPopupMenu()) { chowdsp::SharedLNFAllocator lnfAllocator; diff --git a/src/gui/AnalogEQ/AnalogEQPlot.h b/src/gui/AnalogEQ/AnalogEQPlot.h index de7620a..4d5c541 100644 --- a/src/gui/AnalogEQ/AnalogEQPlot.h +++ b/src/gui/AnalogEQ/AnalogEQPlot.h @@ -9,6 +9,14 @@ namespace gui::analog_eq { class DotSlider; +enum class BandID +{ + None, + Low, + High_Cut, + High_Boost, +}; + class AnalogEQPlot : public chowdsp::SpectrumPlotBase { public: @@ -21,21 +29,25 @@ class AnalogEQPlot : public chowdsp::SpectrumPlotBase void resized() override; - enum class BandID - { - None, - Low, - High_Cut, - High_Boost, - }; - private: void mouseDown (const juce::MouseEvent& event) override; void updatePlot(); void setSelectedBand (BandID bandID); - chowdsp::GenericFilterPlotter filterPlotter; + struct BackgroundPlotter : juce::TimeSliceClient + { + BackgroundPlotter (chowdsp::SpectrumPlotBase& plotBase, juce::Component& parent); + ~BackgroundPlotter() override; + void start(); + int useTimeSlice() override; + + std::atomic_bool needsUpdate { true }; + juce::Component& parent; + chowdsp::GenericFilterPlotter filterPlotter; + juce::SharedResourcePointer sharedTimeSliceThread; + } plotter; + dsp::analog_eq::ExtraState& extraState; dsp::analog_eq::AnalogEQProcessor pultecEQ; diff --git a/src/gui/AnalogEQ/EQChyron.cpp b/src/gui/AnalogEQ/EQChyron.cpp index 2b3bc7b..a8ebd65 100644 --- a/src/gui/AnalogEQ/EQChyron.cpp +++ b/src/gui/AnalogEQ/EQChyron.cpp @@ -1,4 +1,5 @@ #include "EQChyron.h" +#include "AnalogEQPlot.h" #include "gui/Shared/Colours.h" namespace gui::analog_eq @@ -6,7 +7,8 @@ namespace gui::analog_eq constexpr float labelHeightFactor = 0.275f; EQChyron::EQChyron (chowdsp::PluginState& state, dsp::analog_eq::Params& params, const chowdsp::HostContextProvider& hcp) - : lowFreqBoostSlider (state, params.bassBoostParam.get(), &hcp), + : band (BandID::None), + lowFreqBoostSlider (state, params.bassBoostParam.get(), &hcp), lowFreqCutSlider (state, params.bassCutParam.get(), &hcp), lowFreqCutoffSlider (state, params.bassFreqParam.get(), &hcp), highFreqBoostSlider (state, params.trebleBoostParam.get(), &hcp), @@ -15,41 +17,6 @@ EQChyron::EQChyron (chowdsp::PluginState& state, dsp::analog_eq::Params& params, highFreqCutSlider (state, params.trebleCutParam.get(), &hcp), highFreqCutFreqSlider (state, params.trebleCutFreqParam.get(), &hcp) { - for (auto* param : { (chowdsp::FloatParameter*) params.bassBoostParam.get(), - (chowdsp::FloatParameter*) params.bassCutParam.get(), - (chowdsp::FloatParameter*) params.bassFreqParam.get() }) - { - callbacks += { - state.addParameterListener (*param, - chowdsp::ParameterListenerThread::MessageThread, - [this] - { setSelectedBand (EQBand::Bass); }), - }; - } - - for (auto* param : { (chowdsp::FloatParameter*) params.trebleCutParam.get(), - (chowdsp::FloatParameter*) params.trebleCutFreqParam.get() }) - { - callbacks += { - state.addParameterListener (*param, - chowdsp::ParameterListenerThread::MessageThread, - [this] - { setSelectedBand (EQBand::TrebleCut); }), - }; - } - - for (auto* param : { (chowdsp::FloatParameter*) params.trebleBoostParam.get(), - (chowdsp::FloatParameter*) params.trebleBoostFreqParam.get(), - (chowdsp::FloatParameter*) params.trebleBoostQParam.get() }) - { - callbacks += { - state.addParameterListener (*param, - chowdsp::ParameterListenerThread::MessageThread, - [this] - { setSelectedBand (EQBand::TrebleBoost); }), - }; - } - lowFreqBoostSlider.setName ("Boost"); addAndMakeVisible (lowFreqBoostSlider); lowFreqCutSlider.setName ("Cut"); @@ -72,9 +39,9 @@ EQChyron::EQChyron (chowdsp::PluginState& state, dsp::analog_eq::Params& params, setSelectedBand (band); } -void EQChyron::setSelectedBand (EQBand eqBand) +void EQChyron::setSelectedBand (BandID bandID) { - band = eqBand; + band = bandID; lowFreqBoostSlider.setVisible (false); lowFreqCutSlider.setVisible (false); @@ -85,19 +52,19 @@ void EQChyron::setSelectedBand (EQBand eqBand) highFreqCutSlider.setVisible (false); highFreqCutFreqSlider.setVisible (false); - if (band == EQBand::Bass) + if (band == BandID::Low) { lowFreqBoostSlider.setVisible (true); lowFreqCutSlider.setVisible (true); lowFreqCutoffSlider.setVisible (true); } - else if (band == EQBand::TrebleBoost) + else if (band == BandID::High_Boost) { highFreqBoostSlider.setVisible (true); highFreqBoostFreqSlider.setVisible (true); highFreqBoostQSlider.setVisible (true); } - else if (band == EQBand::TrebleCut) + else if (band == BandID::High_Cut) { highFreqCutSlider.setVisible (true); highFreqCutFreqSlider.setVisible (true); @@ -135,16 +102,16 @@ void EQChyron::paint (juce::Graphics& g) g.setColour (colours::linesColour); g.drawRoundedRectangle (bounds.toFloat(), 2.5f, 1.0f); - if (band != EQBand::None) + if (band != BandID::None) { const auto labelBounds = bounds.withHeight (proportionOfHeight (labelHeightFactor)); const auto labelText = [this]() -> juce::String { - if (band == EQBand::Bass) + if (band == BandID::Low) return "Bass"; - if (band == EQBand::TrebleBoost) + if (band == BandID::High_Boost) return "Treble Boost"; - if (band == EQBand::TrebleCut) + if (band == BandID::High_Cut) return "Treble Cut"; return ""; }(); diff --git a/src/gui/AnalogEQ/EQChyron.h b/src/gui/AnalogEQ/EQChyron.h index e2ac486..cb57f77 100644 --- a/src/gui/AnalogEQ/EQChyron.h +++ b/src/gui/AnalogEQ/EQChyron.h @@ -7,14 +7,7 @@ namespace gui::analog_eq { -enum class EQBand -{ - None, - Bass, - TrebleBoost, - TrebleCut, -}; - +enum class BandID; class EQChyron : public juce::Component { public: @@ -22,10 +15,10 @@ class EQChyron : public juce::Component void resized() override; void paint (juce::Graphics& g) override; - void setSelectedBand (EQBand eqBand); + void setSelectedBand (BandID eqBand); private: - EQBand band = EQBand::None; + BandID band; TextSlider lowFreqBoostSlider; TextSlider lowFreqCutSlider; diff --git a/src/gui/BandSplitter/BandSplitterPlot.cpp b/src/gui/BandSplitter/BandSplitterPlot.cpp index 1115c13..3260325 100644 --- a/src/gui/BandSplitter/BandSplitterPlot.cpp +++ b/src/gui/BandSplitter/BandSplitterPlot.cpp @@ -14,7 +14,7 @@ namespace } // namespace BandSplitterPlot::InternalSlider::InternalSlider (chowdsp::FloatParameter& cutoff, - chowdsp::EQ::EqualizerPlot& plot, + EqualizerPlot& plot, State& pluginState, const chowdsp::HostContextProvider& hcp) : cutoffParam (cutoff), @@ -87,12 +87,11 @@ BandSplitterPlot::BandSplitterPlot (State& pluginState, const chowdsp::HostContextProvider& hcp, dsp::band_splitter::BandSplitterSpectrumTasks& splitterSpectrumTasks) - : chowdsp::EQ::EqualizerPlot (numBands, - chowdsp::SpectrumPlotParams { - .minFrequencyHz = (float) minFrequency, - .maxFrequencyHz = (float) maxFrequency, - .minMagnitudeDB = -60.0f, - .maxMagnitudeDB = 6.0f }), + : EqualizerPlot (chowdsp::SpectrumPlotParams { + .minFrequencyHz = (float) minFrequency, + .maxFrequencyHz = (float) maxFrequency, + .minMagnitudeDB = -60.0f, + .maxMagnitudeDB = 6.0f }), bandSplitterParams (bandSplitParams), extraState (bandSplitterExtraState), cutoffSlider (*bandSplitParams.cutoff, *this, pluginState, hcp), @@ -250,7 +249,7 @@ void BandSplitterPlot::paintOverChildren (juce::Graphics& g) void BandSplitterPlot::resized() { - chowdsp::EQ::EqualizerPlot::resized(); + EqualizerPlot::resized(); plotComp.setBounds (getLocalBounds()); const auto pad = proportionOfWidth (0.005f); diff --git a/src/gui/BandSplitter/BandSplitterPlot.h b/src/gui/BandSplitter/BandSplitterPlot.h index d707b23..d8906c3 100644 --- a/src/gui/BandSplitter/BandSplitterPlot.h +++ b/src/gui/BandSplitter/BandSplitterPlot.h @@ -7,7 +7,7 @@ namespace gui::band_splitter { -class BandSplitterPlot : public chowdsp::EQ::EqualizerPlot +class BandSplitterPlot : public chowdsp::EQ::EqualizerPlot<6> { public: BandSplitterPlot (State& pluginState, @@ -44,7 +44,7 @@ class BandSplitterPlot : public chowdsp::EQ::EqualizerPlot struct InternalSlider : juce::Slider { InternalSlider (chowdsp::FloatParameter& cutoffParam, - chowdsp::EQ::EqualizerPlot& plotBase, + EqualizerPlot& plotBase, State& pluginState, const chowdsp::HostContextProvider& hcp); void paint (juce::Graphics& g) override; @@ -55,7 +55,7 @@ class BandSplitterPlot : public chowdsp::EQ::EqualizerPlot juce::Rectangle getThumbBounds() const; chowdsp::FloatParameter& cutoffParam; - chowdsp::EQ::EqualizerPlot& plotBase; + EqualizerPlot& plotBase; chowdsp::SliderAttachment cutoffAttachment; const chowdsp::HostContextProvider& hostContextProvider; } cutoffSlider, cutoff2Slider, cutoff3Slider; diff --git a/src/pch.h b/src/pch.h index 8eeac1c..00794d9 100644 --- a/src/pch.h +++ b/src/pch.h @@ -12,6 +12,7 @@ #include #include +#include #include #include #include diff --git a/src/state/PluginState.h b/src/state/PluginState.h index aa377b9..92e134e 100644 --- a/src/state/PluginState.h +++ b/src/state/PluginState.h @@ -64,12 +64,12 @@ struct PluginParams : chowdsp::ParamHolder }; std::unique_ptr eqParams; - chowdsp::LocalPointer waveshaperParams; - chowdsp::LocalPointer signalGenParams; - chowdsp::LocalPointer analogEQParams; - chowdsp::LocalPointer bandSplitParams; - chowdsp::LocalPointer brickwallParams; - chowdsp::LocalPointer svfParams; + chowdsp::LocalPointer waveshaperParams; + chowdsp::LocalPointer signalGenParams; + chowdsp::LocalPointer analogEQParams; + chowdsp::LocalPointer bandSplitParams; + chowdsp::LocalPointer brickwallParams; + chowdsp::LocalPointer svfParams; }; struct PluginExtraState : chowdsp::NonParamState