Skip to content

Commit

Permalink
4-band Priority Adjusted to Use BandState
Browse files Browse the repository at this point in the history
  • Loading branch information
RachelMaryamLocke committed Jan 25, 2024
1 parent 7306586 commit 0cdc1d2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
25 changes: 11 additions & 14 deletions src/gui/BandSplitter/BandSplitterPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace
constexpr int numBands = 6;
constexpr int minFrequency = 18;
constexpr int maxFrequency = 22'000;
using BandState = dsp::band_splitter::BandState;
} // namespace

BandSplitterPlot::InternalSlider::InternalSlider (chowdsp::FloatParameter& cutoff,
Expand Down Expand Up @@ -141,25 +142,20 @@ BandSplitterPlot::BandSplitterPlot (State& pluginState,
chowdsp::ParameterListenerThread::MessageThread,
[this]
{
if (bandSplitterParams.fourBandOnOff->get() && ! bandSplitterParams.threeBandOnOff->get())
{
bandSplitterParams.fourBandOnOff->setValueNotifyingHost (false);
cutoff3Slider.setVisible (bandSplitterParams.fourBandOnOff->get());
}
cutoff2Slider.setVisible (bandSplitterParams.threeBandOnOff->get());
auto bandState = bandSplitterParams.getCurrentBandState();
cutoff2Slider.setVisible (bandState == BandState::ThreeBands ||
bandState == BandState::FourBands);
updateSpectrumPlots();
repaint();
}),
pluginState.addParameterListener (*bandSplitterParams.fourBandOnOff,
chowdsp::ParameterListenerThread::MessageThread,
[this]
{
if (bandSplitterParams.fourBandOnOff->get() && ! bandSplitterParams.threeBandOnOff->get())
{
bandSplitterParams.threeBandOnOff->setValueNotifyingHost (true);
cutoff2Slider.setVisible (bandSplitterParams.threeBandOnOff->get());
}
cutoff3Slider.setVisible (bandSplitterParams.fourBandOnOff->get());
auto bandState = bandSplitterParams.getCurrentBandState();
cutoff3Slider.setVisible (bandState == BandState::FourBands);
cutoff2Slider.setVisible (bandState == BandState ::FourBands ||
bandState == BandState::ThreeBands);
updateSpectrumPlots();
repaint();
}),
Expand Down Expand Up @@ -250,12 +246,13 @@ void BandSplitterPlot::paintOverChildren (juce::Graphics& g)
g.strokePath (getPath (0), juce::PathStrokeType { 2.0f });
g.strokePath (getPath (1), juce::PathStrokeType { 2.0f });

if (bandSplitterParams.threeBandOnOff->get())
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 (bandSplitterParams.fourBandOnOff->get())
if (bandState == BandState::FourBands)
{
g.strokePath (getPath (4), juce::PathStrokeType { 2.0f });
g.strokePath (getPath (5), juce::PathStrokeType { 2.0f });
Expand Down
7 changes: 6 additions & 1 deletion src/gui/BandSplitter/BandSplitterPlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include "gui/Shared/SpectrumAnalyser.h"
#include "state/PluginState.h"

namespace dsp::band_splitter
{
enum class BandState;
}

namespace gui::band_splitter
{
class BandSplitterPlot : public chowdsp::EQ::EqualizerPlot
Expand All @@ -27,7 +32,7 @@ class BandSplitterPlot : public chowdsp::EQ::EqualizerPlot
void updateSpectrumPlots();
static const chowdsp::FreqHzParameter::Ptr& getCutoffParam (int bandIndex, const dsp::band_splitter::Params& params);

dsp::band_splitter::Params& bandSplitterParams;
const dsp::band_splitter::Params& bandSplitterParams;
dsp::band_splitter::ExtraState& extraState;
chowdsp::ScopedCallbackList callbacks;

Expand Down

0 comments on commit 0cdc1d2

Please sign in to comment.