From e96707d04f768d543643005282e837adfb0cdf61 Mon Sep 17 00:00:00 2001 From: rachelmaryamlocke Date: Mon, 29 Jan 2024 22:49:24 +0000 Subject: [PATCH 1/7] Band-Splitter Chyron Initial Commit --- src/CMakeLists.txt | 1 + src/gui/BandSplitter/BandSplitterChyron.cpp | 97 +++++++++++++++++++++ src/gui/BandSplitter/BandSplitterChyron.h | 33 +++++++ src/gui/BandSplitter/BandSplitterPlot.cpp | 14 ++- src/gui/BandSplitter/BandSplitterPlot.h | 2 + 5 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 src/gui/BandSplitter/BandSplitterChyron.cpp create mode 100644 src/gui/BandSplitter/BandSplitterChyron.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f2764fb..9d1843f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,6 +55,7 @@ target_sources(ChowMultiTool PRIVATE gui/AnalogEQ/AnalogEQPlot.cpp gui/AnalogEQ/EQChyron.cpp + gui/BandSplitter/BandSplitterChyron.cpp gui/BandSplitter/BandSplitterEditor.cpp gui/BandSplitter/BandSplitterPlot.cpp gui/BandSplitter/TriStateButtonAttachment.cpp diff --git a/src/gui/BandSplitter/BandSplitterChyron.cpp b/src/gui/BandSplitter/BandSplitterChyron.cpp new file mode 100644 index 0000000..fdff2f7 --- /dev/null +++ b/src/gui/BandSplitter/BandSplitterChyron.cpp @@ -0,0 +1,97 @@ +#include "BandSplitterChyron.h" + +namespace gui::band_splitter +{ +BandSplitterChyron::BandSplitterChyron (chowdsp::PluginState& pluginState, + dsp::band_splitter::Params& bandSplitterParameters, + const chowdsp::HostContextProvider& hcp) + : state (pluginState), + bandSplitterParams (bandSplitterParameters), + hostContextProvider (hcp) +{ + updateValues(); + callbacks += + { + pluginState.addParameterListener (*bandSplitterParams.threeBandOnOff, + chowdsp::ParameterListenerThread::MessageThread, + [this] + { + updateValues(); + }), + pluginState.addParameterListener (*bandSplitterParams.fourBandOnOff, + chowdsp::ParameterListenerThread::MessageThread, + [this] + { + updateValues(); + }), + }; +} + + +void BandSplitterChyron::updateValues() +{ + + const auto reset = [this] + { + cutoffSliderLow.reset(); + cutoffSliderMid.reset(); + cutoffSliderHigh.reset(); + }; + + reset(); + + auto bandState = bandSplitterParams.getCurrentBandState(); + cutoffSliderLow.emplace(state, bandSplitterParams.cutoff.get(), &hostContextProvider); + cutoffSliderLow->setName("Cutoff Low"); + addAndMakeVisible (*cutoffSliderLow); + + if (bandState != dsp::band_splitter::BandState::TwoBands) + { + cutoffSliderMid.emplace(state, bandSplitterParams.cutoff2.get(), &hostContextProvider); + cutoffSliderMid->setName("Cutoff Mid"); + addAndMakeVisible (*cutoffSliderMid); + } + if (bandState == dsp::band_splitter::BandState::FourBands) + { + cutoffSliderHigh.emplace(state, bandSplitterParams.cutoff3.get(), &hostContextProvider); + cutoffSliderHigh->setName("Cutoff High"); + addAndMakeVisible (*cutoffSliderHigh); + } + resized(); +} + +void BandSplitterChyron::resized() +{ + auto bounds = getLocalBounds(); + const auto sliderBounds = bounds.withHeight (proportionOfHeight (1.0f / 3.0f)); + + if (cutoffSliderMid.has_value() && cutoffSliderHigh.has_value()) + { + const auto fourthHeight = proportionOfHeight (1.0f / 4.0f); + cutoffSliderLow->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), fourthHeight }).reduced (proportionOfWidth (0.025f), 0)); + cutoffSliderMid->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), 2 * fourthHeight }).reduced (proportionOfWidth (0.025f), 0)); + cutoffSliderHigh->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), 3 * fourthHeight }).reduced (proportionOfWidth (0.025f), 0)); + } + else if (cutoffSliderMid.has_value()) + { + const auto thirdHeight = proportionOfHeight (1.0f / 3.0f); + cutoffSliderLow->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), thirdHeight }).reduced (proportionOfWidth (0.025f), 0)); + cutoffSliderMid->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), 2 * thirdHeight }).reduced (proportionOfWidth (0.025f), 0)); + } + else + { + cutoffSliderLow->setBounds (sliderBounds.withCentre (bounds.getCentre()).reduced (proportionOfWidth (0.025f), 0)); + } +} + +void BandSplitterChyron::paint (juce::Graphics& g) +{ + const auto bounds = getLocalBounds(); + + g.setColour (juce::Colours::black.withAlpha (0.75f)); + g.fillRoundedRectangle (bounds.toFloat(), 2.5f); + + g.setColour (colours::linesColour); + g.drawRoundedRectangle (bounds.toFloat(), 2.5f, 1.0f); +} +} // namespace gui::band_splitter \ No newline at end of file diff --git a/src/gui/BandSplitter/BandSplitterChyron.h b/src/gui/BandSplitter/BandSplitterChyron.h new file mode 100644 index 0000000..31fe155 --- /dev/null +++ b/src/gui/BandSplitter/BandSplitterChyron.h @@ -0,0 +1,33 @@ +#pragma once + +#include "dsp/BandSplitter/BandSplitterProcessor.h" +#include "gui/Shared/TextSlider.h" +#include "gui/Shared/Fonts.h" +#include "gui/Shared/Colours.h" + +namespace gui::band_splitter +{ +class BandSplitterChyron : public juce::Component +{ +public: + BandSplitterChyron (chowdsp::PluginState& pluginState, + dsp::band_splitter::Params& bandSplitterParameters, + const chowdsp::HostContextProvider& hcp); + void updateValues(); + void resized() override; + void paint (juce::Graphics& g) override; + +private: + chowdsp::PluginState& state; + dsp::band_splitter::Params& bandSplitterParams; + + std::optional cutoffSliderLow; + std::optional cutoffSliderMid; + std::optional cutoffSliderHigh; + + chowdsp::ScopedCallbackList callbacks; + const chowdsp::HostContextProvider& hostContextProvider; + + SharedFonts fonts; +}; +} // namespace gui::band_splitter \ No newline at end of file diff --git a/src/gui/BandSplitter/BandSplitterPlot.cpp b/src/gui/BandSplitter/BandSplitterPlot.cpp index f578ed1..4f73473 100644 --- a/src/gui/BandSplitter/BandSplitterPlot.cpp +++ b/src/gui/BandSplitter/BandSplitterPlot.cpp @@ -98,7 +98,8 @@ BandSplitterPlot::BandSplitterPlot (State& pluginState, cutoffSlider (*bandSplitParams.cutoff, *this, pluginState, hcp), cutoff2Slider (*bandSplitParams.cutoff2, *this, pluginState, hcp), cutoff3Slider (*bandSplitParams.cutoff3, *this, pluginState, hcp), - spectrumTasks (splitterSpectrumTasks) + spectrumTasks (splitterSpectrumTasks), + chyron(pluginState, bandSplitParams, hcp) { addMouseListener (this, true); extraState.isEditorOpen.store (true); @@ -170,6 +171,9 @@ BandSplitterPlot::BandSplitterPlot (State& pluginState, } }), }; + addAndMakeVisible (chyron); + chyron.toFront (false); + updateFilterSlope(); updateSpectrumPlots(); } @@ -262,6 +266,14 @@ void BandSplitterPlot::resized() { chowdsp::EQ::EqualizerPlot::resized(); + const auto pad = proportionOfWidth (0.005f); + const auto chyronWidth = proportionOfWidth (0.20f); + const auto chyronHeight = proportionOfWidth (0.1f); + chyron.setBounds (getWidth() - pad - chyronWidth, + getHeight() - pad - chyronHeight - proportionOfHeight (0.075f), + chyronWidth, + chyronHeight); + const auto bounds = getLocalBounds(); for (auto [_, spectrum] : spectrumAnalysers) spectrum->setBounds (bounds); diff --git a/src/gui/BandSplitter/BandSplitterPlot.h b/src/gui/BandSplitter/BandSplitterPlot.h index 8b50bcc..c65431a 100644 --- a/src/gui/BandSplitter/BandSplitterPlot.h +++ b/src/gui/BandSplitter/BandSplitterPlot.h @@ -3,6 +3,7 @@ #include "dsp/BandSplitter/BandSplitterProcessor.h" #include "gui/Shared/SpectrumAnalyser.h" #include "state/PluginState.h" +#include "BandSplitterChyron.h" namespace gui::band_splitter { @@ -52,6 +53,7 @@ class BandSplitterPlot : public chowdsp::EQ::EqualizerPlot dsp::band_splitter::BandSplitterSpectrumTasks& spectrumTasks; chowdsp::SmallMap> spectrumAnalysers; + BandSplitterChyron chyron; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BandSplitterPlot) }; From 3e8a4595184e81e5679fa8ee84e039a938dfbc1f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Jan 2024 23:01:17 +0000 Subject: [PATCH 2/7] Apply clang-format --- src/gui/BandSplitter/BandSplitterChyron.cpp | 14 ++++++-------- src/gui/BandSplitter/BandSplitterChyron.h | 4 ++-- src/gui/BandSplitter/BandSplitterPlot.cpp | 2 +- src/gui/BandSplitter/BandSplitterPlot.h | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/gui/BandSplitter/BandSplitterChyron.cpp b/src/gui/BandSplitter/BandSplitterChyron.cpp index fdff2f7..59cf4d2 100644 --- a/src/gui/BandSplitter/BandSplitterChyron.cpp +++ b/src/gui/BandSplitter/BandSplitterChyron.cpp @@ -27,10 +27,8 @@ BandSplitterChyron::BandSplitterChyron (chowdsp::PluginState& pluginState, }; } - void BandSplitterChyron::updateValues() { - const auto reset = [this] { cutoffSliderLow.reset(); @@ -41,20 +39,20 @@ void BandSplitterChyron::updateValues() reset(); auto bandState = bandSplitterParams.getCurrentBandState(); - cutoffSliderLow.emplace(state, bandSplitterParams.cutoff.get(), &hostContextProvider); - cutoffSliderLow->setName("Cutoff Low"); + cutoffSliderLow.emplace (state, bandSplitterParams.cutoff.get(), &hostContextProvider); + cutoffSliderLow->setName ("Cutoff Low"); addAndMakeVisible (*cutoffSliderLow); if (bandState != dsp::band_splitter::BandState::TwoBands) { - cutoffSliderMid.emplace(state, bandSplitterParams.cutoff2.get(), &hostContextProvider); - cutoffSliderMid->setName("Cutoff Mid"); + cutoffSliderMid.emplace (state, bandSplitterParams.cutoff2.get(), &hostContextProvider); + cutoffSliderMid->setName ("Cutoff Mid"); addAndMakeVisible (*cutoffSliderMid); } if (bandState == dsp::band_splitter::BandState::FourBands) { - cutoffSliderHigh.emplace(state, bandSplitterParams.cutoff3.get(), &hostContextProvider); - cutoffSliderHigh->setName("Cutoff High"); + cutoffSliderHigh.emplace (state, bandSplitterParams.cutoff3.get(), &hostContextProvider); + cutoffSliderHigh->setName ("Cutoff High"); addAndMakeVisible (*cutoffSliderHigh); } resized(); diff --git a/src/gui/BandSplitter/BandSplitterChyron.h b/src/gui/BandSplitter/BandSplitterChyron.h index 31fe155..b6ee92f 100644 --- a/src/gui/BandSplitter/BandSplitterChyron.h +++ b/src/gui/BandSplitter/BandSplitterChyron.h @@ -1,9 +1,9 @@ #pragma once #include "dsp/BandSplitter/BandSplitterProcessor.h" -#include "gui/Shared/TextSlider.h" -#include "gui/Shared/Fonts.h" #include "gui/Shared/Colours.h" +#include "gui/Shared/Fonts.h" +#include "gui/Shared/TextSlider.h" namespace gui::band_splitter { diff --git a/src/gui/BandSplitter/BandSplitterPlot.cpp b/src/gui/BandSplitter/BandSplitterPlot.cpp index 4f73473..f92b0f4 100644 --- a/src/gui/BandSplitter/BandSplitterPlot.cpp +++ b/src/gui/BandSplitter/BandSplitterPlot.cpp @@ -99,7 +99,7 @@ BandSplitterPlot::BandSplitterPlot (State& pluginState, cutoff2Slider (*bandSplitParams.cutoff2, *this, pluginState, hcp), cutoff3Slider (*bandSplitParams.cutoff3, *this, pluginState, hcp), spectrumTasks (splitterSpectrumTasks), - chyron(pluginState, bandSplitParams, hcp) + chyron (pluginState, bandSplitParams, hcp) { addMouseListener (this, true); extraState.isEditorOpen.store (true); diff --git a/src/gui/BandSplitter/BandSplitterPlot.h b/src/gui/BandSplitter/BandSplitterPlot.h index c65431a..e1f3fa4 100644 --- a/src/gui/BandSplitter/BandSplitterPlot.h +++ b/src/gui/BandSplitter/BandSplitterPlot.h @@ -1,9 +1,9 @@ #pragma once +#include "BandSplitterChyron.h" #include "dsp/BandSplitter/BandSplitterProcessor.h" #include "gui/Shared/SpectrumAnalyser.h" #include "state/PluginState.h" -#include "BandSplitterChyron.h" namespace gui::band_splitter { From b805a57576bea95602b2e3496ffafb6d7c056e4a Mon Sep 17 00:00:00 2001 From: rachelmaryamlocke Date: Tue, 30 Jan 2024 14:41:41 +0000 Subject: [PATCH 3/7] Filter Plotting Component Added to Paint Filter Slopes and Chyron Cutoff Names Adjusted For 3-Band/4-Band --- src/gui/BandSplitter/BandSplitterChyron.cpp | 5 ++- src/gui/BandSplitter/BandSplitterPlot.cpp | 40 ++++++++++++--------- src/gui/BandSplitter/BandSplitterPlot.h | 9 +++++ 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/gui/BandSplitter/BandSplitterChyron.cpp b/src/gui/BandSplitter/BandSplitterChyron.cpp index 59cf4d2..d039807 100644 --- a/src/gui/BandSplitter/BandSplitterChyron.cpp +++ b/src/gui/BandSplitter/BandSplitterChyron.cpp @@ -46,7 +46,10 @@ void BandSplitterChyron::updateValues() if (bandState != dsp::band_splitter::BandState::TwoBands) { cutoffSliderMid.emplace (state, bandSplitterParams.cutoff2.get(), &hostContextProvider); - cutoffSliderMid->setName ("Cutoff Mid"); + if (bandState == dsp::band_splitter::BandState::ThreeBands) + cutoffSliderMid->setName ("Cutoff High"); + else + cutoffSliderMid->setName ("Cutoff Mid"); addAndMakeVisible (*cutoffSliderMid); } if (bandState == dsp::band_splitter::BandState::FourBands) diff --git a/src/gui/BandSplitter/BandSplitterPlot.cpp b/src/gui/BandSplitter/BandSplitterPlot.cpp index f92b0f4..4e9bed2 100644 --- a/src/gui/BandSplitter/BandSplitterPlot.cpp +++ b/src/gui/BandSplitter/BandSplitterPlot.cpp @@ -110,6 +110,10 @@ BandSplitterPlot::BandSplitterPlot (State& pluginState, cutoff2Slider.setVisible (bandSplitterParams.threeBandOnOff->get()); cutoff3Slider.setVisible (bandSplitterParams.fourBandOnOff->get()); + plotComp.setInterceptsMouseClicks (false, false); + plotComp.parent = this; + addAndMakeVisible (plotComp); + for (int bandIndex = 0; bandIndex < numBands; ++bandIndex) setFilterActive (bandIndex, true); @@ -244,28 +248,13 @@ void BandSplitterPlot::paintOverChildren (juce::Graphics& g) { 0.0f }, colours::majorLinesColour, colours::minorLinesColour); - - g.setColour (colours::plotColour); - g.strokePath (getPath (0), juce::PathStrokeType { 2.0f }); - g.strokePath (getPath (1), juce::PathStrokeType { 2.0f }); - - auto bandState = bandSplitterParams.getCurrentBandState(); - if (bandState == BandState::FourBands || bandState == BandState::ThreeBands) - { - g.strokePath (getPath (2), juce::PathStrokeType { 2.0f }); - g.strokePath (getPath (3), juce::PathStrokeType { 2.0f }); - } - if (bandState == BandState::FourBands) - { - g.strokePath (getPath (4), juce::PathStrokeType { 2.0f }); - g.strokePath (getPath (5), juce::PathStrokeType { 2.0f }); - } } void BandSplitterPlot::resized() { chowdsp::EQ::EqualizerPlot::resized(); + plotComp.setBounds (getLocalBounds()); const auto pad = proportionOfWidth (0.005f); const auto chyronWidth = proportionOfWidth (0.20f); const auto chyronHeight = proportionOfWidth (0.1f); @@ -383,4 +372,23 @@ const chowdsp::FreqHzParameter::Ptr& BandSplitterPlot::getCutoffParam (int bandI else return bandParams.cutoff3; }; + +void BandSplitterPlot::FilterPlotComp::paint (juce::Graphics& g) +{ + g.setColour (colours::plotColour); + g.strokePath (parent->getPath (0), juce::PathStrokeType { 2.0f }); + g.strokePath (parent->getPath (1), juce::PathStrokeType { 2.0f }); + + auto bandState = parent->bandSplitterParams.getCurrentBandState(); + if (bandState == BandState::FourBands || bandState == BandState::ThreeBands) + { + g.strokePath (parent->getPath (2), juce::PathStrokeType { 2.0f }); + g.strokePath (parent->getPath (3), juce::PathStrokeType { 2.0f }); + } + if (bandState == BandState::FourBands) + { + g.strokePath (parent->getPath (4), juce::PathStrokeType { 2.0f }); + g.strokePath (parent->getPath (5), juce::PathStrokeType { 2.0f }); + } +} } // namespace gui::band_splitter diff --git a/src/gui/BandSplitter/BandSplitterPlot.h b/src/gui/BandSplitter/BandSplitterPlot.h index e1f3fa4..d707b23 100644 --- a/src/gui/BandSplitter/BandSplitterPlot.h +++ b/src/gui/BandSplitter/BandSplitterPlot.h @@ -28,9 +28,18 @@ class BandSplitterPlot : public chowdsp::EQ::EqualizerPlot void updateSpectrumPlots(); static const chowdsp::FreqHzParameter::Ptr& getCutoffParam (int bandIndex, const dsp::band_splitter::Params& params); + struct FilterPlotComp : juce::Component + { + void paint (juce::Graphics& g); + void resized() { repaint(); } + + BandSplitterPlot* parent = nullptr; + }; + const dsp::band_splitter::Params& bandSplitterParams; dsp::band_splitter::ExtraState& extraState; chowdsp::ScopedCallbackList callbacks; + FilterPlotComp plotComp; struct InternalSlider : juce::Slider { From a5e78ea4db5e8b227f92bfcb419432363429b5c5 Mon Sep 17 00:00:00 2001 From: rachelmaryamlocke Date: Tue, 30 Jan 2024 19:16:23 +0000 Subject: [PATCH 4/7] Chyron Clean-Up --- src/gui/BandSplitter/BandSplitterChyron.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/gui/BandSplitter/BandSplitterChyron.cpp b/src/gui/BandSplitter/BandSplitterChyron.cpp index d039807..e21e291 100644 --- a/src/gui/BandSplitter/BandSplitterChyron.cpp +++ b/src/gui/BandSplitter/BandSplitterChyron.cpp @@ -29,14 +29,9 @@ BandSplitterChyron::BandSplitterChyron (chowdsp::PluginState& pluginState, void BandSplitterChyron::updateValues() { - const auto reset = [this] - { - cutoffSliderLow.reset(); - cutoffSliderMid.reset(); - cutoffSliderHigh.reset(); - }; - - reset(); + cutoffSliderLow.reset(); + cutoffSliderMid.reset(); + cutoffSliderHigh.reset(); auto bandState = bandSplitterParams.getCurrentBandState(); cutoffSliderLow.emplace (state, bandSplitterParams.cutoff.get(), &hostContextProvider); From 319dff33a7d05836ebef492598ad786172264b49 Mon Sep 17 00:00:00 2001 From: rachelmaryamlocke Date: Thu, 1 Feb 2024 15:39:01 +0000 Subject: [PATCH 5/7] Cutoff Low Changed to Cutoff for 2-Band Mode --- src/gui/BandSplitter/BandSplitterChyron.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/BandSplitter/BandSplitterChyron.cpp b/src/gui/BandSplitter/BandSplitterChyron.cpp index e21e291..8fb6cb3 100644 --- a/src/gui/BandSplitter/BandSplitterChyron.cpp +++ b/src/gui/BandSplitter/BandSplitterChyron.cpp @@ -35,7 +35,10 @@ void BandSplitterChyron::updateValues() auto bandState = bandSplitterParams.getCurrentBandState(); cutoffSliderLow.emplace (state, bandSplitterParams.cutoff.get(), &hostContextProvider); - cutoffSliderLow->setName ("Cutoff Low"); + if (bandState == dsp::band_splitter::BandState::TwoBands) + cutoffSliderLow->setName ("Cutoff"); + else + cutoffSliderLow->setName ("Cutoff Low"); addAndMakeVisible (*cutoffSliderLow); if (bandState != dsp::band_splitter::BandState::TwoBands) From dae065c245665cc07d2fca6187e814778545af0a Mon Sep 17 00:00:00 2001 From: jatin Date: Thu, 1 Feb 2024 21:18:59 -0800 Subject: [PATCH 6/7] Fixing preset rebase --- res/presets/Init.chowpreset | Bin 287334 -> 287502 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/res/presets/Init.chowpreset b/res/presets/Init.chowpreset index 5d3b92230f7e9894ca5bb34ec5b538346244063b..cfaaa61c6680769828dfb8f7eb4d7bf00e13c063 100644 GIT binary patch delta 70 zcmaEMM6mCe;D#zjMw7|vj5`_4Cg<~LP8MJkn|y|mhufGziNT6Nfx(c$6eixR#MG|D Q#0bP7nt8ht6N^g%0Jn1x%K!iX delta 54 zcmeA>Civ`#;D##3$qGz7lh=qDOcr1i1F}UXzYx&@v71jZwVz^Q1Y!`)y!{jti%S9k D2o4eh From 78a80953ffefd9831358c94df4dacd7eb16b6acc Mon Sep 17 00:00:00 2001 From: jatin Date: Thu, 1 Feb 2024 21:20:05 -0800 Subject: [PATCH 7/7] Renaming slider variables --- src/gui/BandSplitter/BandSplitterChyron.cpp | 44 ++++++++++----------- src/gui/BandSplitter/BandSplitterChyron.h | 6 +-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/gui/BandSplitter/BandSplitterChyron.cpp b/src/gui/BandSplitter/BandSplitterChyron.cpp index 8fb6cb3..adb65ab 100644 --- a/src/gui/BandSplitter/BandSplitterChyron.cpp +++ b/src/gui/BandSplitter/BandSplitterChyron.cpp @@ -29,32 +29,32 @@ BandSplitterChyron::BandSplitterChyron (chowdsp::PluginState& pluginState, void BandSplitterChyron::updateValues() { - cutoffSliderLow.reset(); - cutoffSliderMid.reset(); - cutoffSliderHigh.reset(); + cutoffSlider1.reset(); + cutoffSlider2.reset(); + cutoffSlider3.reset(); auto bandState = bandSplitterParams.getCurrentBandState(); - cutoffSliderLow.emplace (state, bandSplitterParams.cutoff.get(), &hostContextProvider); + cutoffSlider1.emplace (state, bandSplitterParams.cutoff.get(), &hostContextProvider); if (bandState == dsp::band_splitter::BandState::TwoBands) - cutoffSliderLow->setName ("Cutoff"); + cutoffSlider1->setName ("Cutoff"); else - cutoffSliderLow->setName ("Cutoff Low"); - addAndMakeVisible (*cutoffSliderLow); + cutoffSlider1->setName ("Cutoff Low"); + addAndMakeVisible (*cutoffSlider1); if (bandState != dsp::band_splitter::BandState::TwoBands) { - cutoffSliderMid.emplace (state, bandSplitterParams.cutoff2.get(), &hostContextProvider); + cutoffSlider2.emplace (state, bandSplitterParams.cutoff2.get(), &hostContextProvider); if (bandState == dsp::band_splitter::BandState::ThreeBands) - cutoffSliderMid->setName ("Cutoff High"); + cutoffSlider2->setName ("Cutoff High"); else - cutoffSliderMid->setName ("Cutoff Mid"); - addAndMakeVisible (*cutoffSliderMid); + cutoffSlider2->setName ("Cutoff Mid"); + addAndMakeVisible (*cutoffSlider2); } if (bandState == dsp::band_splitter::BandState::FourBands) { - cutoffSliderHigh.emplace (state, bandSplitterParams.cutoff3.get(), &hostContextProvider); - cutoffSliderHigh->setName ("Cutoff High"); - addAndMakeVisible (*cutoffSliderHigh); + cutoffSlider3.emplace (state, bandSplitterParams.cutoff3.get(), &hostContextProvider); + cutoffSlider3->setName ("Cutoff High"); + addAndMakeVisible (*cutoffSlider3); } resized(); } @@ -64,22 +64,22 @@ void BandSplitterChyron::resized() auto bounds = getLocalBounds(); const auto sliderBounds = bounds.withHeight (proportionOfHeight (1.0f / 3.0f)); - if (cutoffSliderMid.has_value() && cutoffSliderHigh.has_value()) + if (cutoffSlider2.has_value() && cutoffSlider3.has_value()) { const auto fourthHeight = proportionOfHeight (1.0f / 4.0f); - cutoffSliderLow->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), fourthHeight }).reduced (proportionOfWidth (0.025f), 0)); - cutoffSliderMid->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), 2 * fourthHeight }).reduced (proportionOfWidth (0.025f), 0)); - cutoffSliderHigh->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), 3 * fourthHeight }).reduced (proportionOfWidth (0.025f), 0)); + cutoffSlider1->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), fourthHeight }).reduced (proportionOfWidth (0.025f), 0)); + cutoffSlider2->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), 2 * fourthHeight }).reduced (proportionOfWidth (0.025f), 0)); + cutoffSlider3->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), 3 * fourthHeight }).reduced (proportionOfWidth (0.025f), 0)); } - else if (cutoffSliderMid.has_value()) + else if (cutoffSlider2.has_value()) { const auto thirdHeight = proportionOfHeight (1.0f / 3.0f); - cutoffSliderLow->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), thirdHeight }).reduced (proportionOfWidth (0.025f), 0)); - cutoffSliderMid->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), 2 * thirdHeight }).reduced (proportionOfWidth (0.025f), 0)); + cutoffSlider1->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), thirdHeight }).reduced (proportionOfWidth (0.025f), 0)); + cutoffSlider2->setBounds (sliderBounds.withCentre ({ bounds.getCentreX(), 2 * thirdHeight }).reduced (proportionOfWidth (0.025f), 0)); } else { - cutoffSliderLow->setBounds (sliderBounds.withCentre (bounds.getCentre()).reduced (proportionOfWidth (0.025f), 0)); + cutoffSlider1->setBounds (sliderBounds.withCentre (bounds.getCentre()).reduced (proportionOfWidth (0.025f), 0)); } } diff --git a/src/gui/BandSplitter/BandSplitterChyron.h b/src/gui/BandSplitter/BandSplitterChyron.h index b6ee92f..19c313b 100644 --- a/src/gui/BandSplitter/BandSplitterChyron.h +++ b/src/gui/BandSplitter/BandSplitterChyron.h @@ -21,9 +21,9 @@ class BandSplitterChyron : public juce::Component chowdsp::PluginState& state; dsp::band_splitter::Params& bandSplitterParams; - std::optional cutoffSliderLow; - std::optional cutoffSliderMid; - std::optional cutoffSliderHigh; + std::optional cutoffSlider1; + std::optional cutoffSlider2; + std::optional cutoffSlider3; chowdsp::ScopedCallbackList callbacks; const chowdsp::HostContextProvider& hostContextProvider;