-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Band-Splitter Chyron Initial Commit * Apply clang-format * Filter Plotting Component Added to Paint Filter Slopes and Chyron Cutoff Names Adjusted For 3-Band/4-Band * Chyron Clean-Up * Cutoff Low Changed to Cutoff for 2-Band Mode * Fixing preset rebase * Renaming slider variables --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: jatin <[email protected]>
- Loading branch information
1 parent
301b827
commit fe769a2
Showing
6 changed files
with
178 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#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() | ||
{ | ||
cutoffSlider1.reset(); | ||
cutoffSlider2.reset(); | ||
cutoffSlider3.reset(); | ||
|
||
auto bandState = bandSplitterParams.getCurrentBandState(); | ||
cutoffSlider1.emplace (state, bandSplitterParams.cutoff.get(), &hostContextProvider); | ||
if (bandState == dsp::band_splitter::BandState::TwoBands) | ||
cutoffSlider1->setName ("Cutoff"); | ||
else | ||
cutoffSlider1->setName ("Cutoff Low"); | ||
addAndMakeVisible (*cutoffSlider1); | ||
|
||
if (bandState != dsp::band_splitter::BandState::TwoBands) | ||
{ | ||
cutoffSlider2.emplace (state, bandSplitterParams.cutoff2.get(), &hostContextProvider); | ||
if (bandState == dsp::band_splitter::BandState::ThreeBands) | ||
cutoffSlider2->setName ("Cutoff High"); | ||
else | ||
cutoffSlider2->setName ("Cutoff Mid"); | ||
addAndMakeVisible (*cutoffSlider2); | ||
} | ||
if (bandState == dsp::band_splitter::BandState::FourBands) | ||
{ | ||
cutoffSlider3.emplace (state, bandSplitterParams.cutoff3.get(), &hostContextProvider); | ||
cutoffSlider3->setName ("Cutoff High"); | ||
addAndMakeVisible (*cutoffSlider3); | ||
} | ||
resized(); | ||
} | ||
|
||
void BandSplitterChyron::resized() | ||
{ | ||
auto bounds = getLocalBounds(); | ||
const auto sliderBounds = bounds.withHeight (proportionOfHeight (1.0f / 3.0f)); | ||
|
||
if (cutoffSlider2.has_value() && cutoffSlider3.has_value()) | ||
{ | ||
const auto fourthHeight = proportionOfHeight (1.0f / 4.0f); | ||
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 (cutoffSlider2.has_value()) | ||
{ | ||
const auto thirdHeight = proportionOfHeight (1.0f / 3.0f); | ||
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 | ||
{ | ||
cutoffSlider1->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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include "dsp/BandSplitter/BandSplitterProcessor.h" | ||
#include "gui/Shared/Colours.h" | ||
#include "gui/Shared/Fonts.h" | ||
#include "gui/Shared/TextSlider.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<TextSlider> cutoffSlider1; | ||
std::optional<TextSlider> cutoffSlider2; | ||
std::optional<TextSlider> cutoffSlider3; | ||
|
||
chowdsp::ScopedCallbackList callbacks; | ||
const chowdsp::HostContextProvider& hostContextProvider; | ||
|
||
SharedFonts fonts; | ||
}; | ||
} // namespace gui::band_splitter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters