diff options
| author | Dominik Kaiser | 2025-10-06 12:52:57 +0200 |
|---|---|---|
| committer | Dominik Kaiser | 2025-10-06 12:52:57 +0200 |
| commit | 1861458f4fa4647379d372858222d6481beaa015 (patch) | |
| tree | 556b9215b2715ab962891d44d93affab0bd1b6b3 /src/UI | |
| parent | 282f670fe24bb772e1eb2929e1cb4c58ca3ad166 (diff) | |
| download | SchroederReverb-1861458f4fa4647379d372858222d6481beaa015.tar.gz SchroederReverb-1861458f4fa4647379d372858222d6481beaa015.zip | |
Add dry/wet mix slider
Diffstat (limited to 'src/UI')
| -rw-r--r-- | src/UI/PluginEditor.cpp | 26 | ||||
| -rw-r--r-- | src/UI/PluginEditor.h | 2 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/UI/PluginEditor.cpp b/src/UI/PluginEditor.cpp index b3b8256..aedb799 100644 --- a/src/UI/PluginEditor.cpp +++ b/src/UI/PluginEditor.cpp @@ -6,9 +6,21 @@ SchroederReverbAudioProcessorEditor::SchroederReverbAudioProcessorEditor( SchroederReverbAudioProcessor& p) : AudioProcessorEditor(&p), processorRef(p) { - juce::ignoreUnused(processorRef); - // Make sure that before the constructor has finished, you've set the - // editor's size to whatever you need it to be. + mixParam = processorRef.dryWetMix; + mixSlider.setSliderStyle(juce::Slider::LinearHorizontal); + mixSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 50, 20); + mixSlider.setRange(0.0, 1.0, 0.01); + addAndMakeVisible(mixSlider); + + mixSlider.setValue(mixParam->get()); + mixSlider.onValueChange = [this]() + { + if (mixParam != nullptr) + { + *mixParam = (float)mixSlider.getValue(); + } + }; + setSize(400, 300); } @@ -18,17 +30,11 @@ SchroederReverbAudioProcessorEditor::~SchroederReverbAudioProcessorEditor() {} void SchroederReverbAudioProcessorEditor::paint(juce::Graphics& g) { - // (Our component is opaque, so we must completely fill the background with a solid colour) g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId)); - - g.setColour(juce::Colours::white); - g.setFont(15.0f); - g.drawFittedText("Hello World!", getLocalBounds(), juce::Justification::centred, 1); } void SchroederReverbAudioProcessorEditor::resized() { - // This is generally where you'll want to lay out the positions of any - // subcomponents in your editor.. + mixSlider.setBounds(40, 80, getWidth() - 80, 20); } diff --git a/src/UI/PluginEditor.h b/src/UI/PluginEditor.h index 1f7a5bb..9e40c78 100644 --- a/src/UI/PluginEditor.h +++ b/src/UI/PluginEditor.h @@ -17,6 +17,8 @@ class SchroederReverbAudioProcessorEditor final : public juce::AudioProcessorEdi // This reference is provided as a quick way for your editor to // access the processor object that created it. SchroederReverbAudioProcessor& processorRef; + juce::Slider mixSlider; + juce::AudioParameterFloat* mixParam = nullptr; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SchroederReverbAudioProcessorEditor) }; |
