Skip to content

Commit

Permalink
Add cutoff label for Brickwall
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Nov 12, 2023
1 parent b6048c8 commit 20402e8
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ target_sources(ChowMultiTool PRIVATE

gui/Brickwall/BrickwallEditor.cpp
gui/Brickwall/BrickwallPlot.cpp
gui/Brickwall/BrickwallChyron.cpp
gui/Brickwall/BottomBar.cpp

gui/AnalogEQ/AnalogEQEditor.cpp
Expand Down
32 changes: 32 additions & 0 deletions src/gui/Brickwall/BrickwallChyron.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "BrickwallChyron.h"
#include "gui/Shared/Colours.h"

namespace gui::brickwall
{
BrickwallChyron::BrickwallChyron (chowdsp::PluginState& pluginState,
dsp::brickwall::Params& params,
const chowdsp::HostContextProvider& hcp)
: state (pluginState),
cutoffSlider (state, params.cutoff.get(), &hcp)
{
cutoffSlider.setName ("Cutoff");
addAndMakeVisible (cutoffSlider);
}

void BrickwallChyron::resized()
{
auto bounds = getLocalBounds();
cutoffSlider.setBounds (bounds.reduced (proportionOfHeight (0.2f)));
}

void BrickwallChyron::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::brickwall
28 changes: 28 additions & 0 deletions src/gui/Brickwall/BrickwallChyron.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

#include "dsp/Brickwall/BrickwallProcessor.h"
#include "gui/Shared/Fonts.h"
#include "gui/Shared/TextSlider.h"

namespace gui::brickwall
{
class BrickwallChyron : public juce::Component
{
public:
BrickwallChyron (chowdsp::PluginState& pluginState,
dsp::brickwall::Params& params,
const chowdsp::HostContextProvider& hcp);

void resized() override;
void paint (juce::Graphics& g) override;

private:
chowdsp::PluginState& state;

TextSlider cutoffSlider;

SharedFonts fonts;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BrickwallChyron)
};
}
12 changes: 11 additions & 1 deletion src/gui/Brickwall/BrickwallPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ BrickwallPlot::BrickwallPlot (State& pluginState, dsp::brickwall::Params& brickw
.fftOrder = fftOrder,
}),
brickwall (brickwallParams),
cutoffSlider (*brickwallParams.cutoff, *this, pluginState, hcp)
cutoffSlider (*brickwallParams.cutoff, *this, pluginState, hcp),
chyron (pluginState, brickwallParams, hcp)
{
addAndMakeVisible (cutoffSlider);
addAndMakeVisible (chyron);

brickwall.prepare ({ sampleRate, (uint32_t) blockSize, 1 });
filterPlotter.runFilterCallback = [this] (const float* input, float* output, int numSamples)
Expand Down Expand Up @@ -162,5 +164,13 @@ void BrickwallPlot::resized()
{
updatePlot();
cutoffSlider.setBounds (getLocalBounds());

const auto pad = proportionOfWidth (0.005f);
const auto chyronWidth = proportionOfWidth (0.15f);
const auto chyronHeight = proportionOfWidth (0.05f);
chyron.setBounds (getWidth() - pad - chyronWidth,
getHeight() - pad - proportionOfHeight (0.075f) - chyronHeight,
chyronWidth,
chyronHeight);
}
} // namespace gui::brickwall
3 changes: 3 additions & 0 deletions src/gui/Brickwall/BrickwallPlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "dsp/Brickwall/BrickwallProcessor.h"
#include "state/PluginState.h"
#include "BrickwallChyron.h"

namespace gui::brickwall
{
Expand Down Expand Up @@ -41,6 +42,8 @@ class BrickwallPlot : public chowdsp::SpectrumPlotBase
const chowdsp::HostContextProvider& hostContextProvider;
} cutoffSlider;

BrickwallChyron chyron;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BrickwallPlot)
};
} // namespace gui::brickwall

0 comments on commit 20402e8

Please sign in to comment.