diff --git a/Source/BasicParamsComponent.cpp b/Source/BasicParamsComponent.cpp index 2576362..d9c93dd 100644 --- a/Source/BasicParamsComponent.cpp +++ b/Source/BasicParamsComponent.cpp @@ -7,12 +7,12 @@ the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. - Created with Projucer version: 5.4.5 + Created with Projucer version: 6.0.8 ------------------------------------------------------------------------------ The Projucer is part of the JUCE library. - Copyright (c) 2017 - ROLI Ltd. + Copyright (c) 2020 - Raw Material Software Limited. ============================================================================== */ @@ -34,14 +34,14 @@ BasicParamsComponent::BasicParamsComponent (Magical8bitPlug2AudioProcessor& p, M //[Constructor_pre] You can add your own custom stuff here.. //[/Constructor_pre] - polyLabel.reset (new Label ("label", - TRANS("Poly"))); + polyLabel.reset (new juce::Label ("label", + TRANS("Poly"))); addAndMakeVisible (polyLabel.get()); - polyLabel->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular")); - polyLabel->setJustificationType (Justification::centredLeft); + polyLabel->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular")); + polyLabel->setJustificationType (juce::Justification::centredLeft); polyLabel->setEditable (false, false, false); - polyLabel->setColour (TextEditor::textColourId, Colours::black); - polyLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + polyLabel->setColour (juce::TextEditor::textColourId, juce::Colours::black); + polyLabel->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000)); polyLabel->setBounds (232, 8, 40, 15); @@ -49,7 +49,7 @@ BasicParamsComponent::BasicParamsComponent (Magical8bitPlug2AudioProcessor& p, M addAndMakeVisible (gainSlider.get()); gainSlider->setName ("gain slider"); - gainSlider->setBounds (0, 32, 360, 32); + gainSlider->setBounds (0, 32, 380, 32); oscChoice.reset (new ChoiceComponent (p, "osc", "OSC Type")); addAndMakeVisible (oscChoice.get()); @@ -57,16 +57,16 @@ BasicParamsComponent::BasicParamsComponent (Magical8bitPlug2AudioProcessor& p, M oscChoice->setBounds (0, 4, 224, 28); - polyNumberInput.reset (new Slider ("poly number input")); + polyNumberInput.reset (new juce::Slider ("poly number input")); addAndMakeVisible (polyNumberInput.get()); polyNumberInput->setRange (0, 32, 1); - polyNumberInput->setSliderStyle (Slider::IncDecButtons); - polyNumberInput->setTextBoxStyle (Slider::TextBoxLeft, false, 30, 20); + polyNumberInput->setSliderStyle (juce::Slider::IncDecButtons); + polyNumberInput->setTextBoxStyle (juce::Slider::TextBoxLeft, false, 30, 20); polyNumberInput->addListener (this); polyNumberInput->setBounds (268, 4, 86, 24); - advancedSwitch.reset (new CheckBoxComponent (p, "isAdvancedPanelOpen_raw", "Show Advanced Options")); + advancedSwitch.reset (new CheckBoxComponent (p, "isAdvancedPanelOpen_raw", "Advanced Options")); addAndMakeVisible (advancedSwitch.get()); advancedSwitch->setName ("advanced option switch"); @@ -74,6 +74,13 @@ BasicParamsComponent::BasicParamsComponent (Magical8bitPlug2AudioProcessor& p, M addAndMakeVisible (colorSchemeChoice.get()); colorSchemeChoice->setName ("color selector"); + monoButton.reset (new juce::TextButton ("mono button")); + addAndMakeVisible (monoButton.get()); + monoButton->setButtonText (TRANS("mono")); + monoButton->addListener (this); + + monoButton->setBounds (360, 4, 54, 24); + //[UserPreSize] //[/UserPreSize] @@ -104,6 +111,7 @@ BasicParamsComponent::~BasicParamsComponent() polyNumberInput = nullptr; advancedSwitch = nullptr; colorSchemeChoice = nullptr; + monoButton = nullptr; //[Destructor]. You can add your own custom destruction code here.. @@ -111,7 +119,7 @@ BasicParamsComponent::~BasicParamsComponent() } //============================================================================== -void BasicParamsComponent::paint (Graphics& g) +void BasicParamsComponent::paint (juce::Graphics& g) { //[UserPrePaint] Add your own custom painting code here.. //[/UserPrePaint] @@ -125,13 +133,13 @@ void BasicParamsComponent::resized() //[UserPreResize] Add your own custom resize code here.. //[/UserPreResize] - advancedSwitch->setBounds (getWidth() - 240, 4, 240, 28); + advancedSwitch->setBounds (getWidth() - 180, 4, 180, 28); colorSchemeChoice->setBounds (getWidth() - 4 - 185, 32, 185, 28); //[UserResized] Add your own custom resize handling here.. //[/UserResized] } -void BasicParamsComponent::sliderValueChanged (Slider* sliderThatWasMoved) +void BasicParamsComponent::sliderValueChanged (juce::Slider* sliderThatWasMoved) { //[UsersliderValueChanged_Pre] //[/UsersliderValueChanged_Pre] @@ -140,6 +148,7 @@ void BasicParamsComponent::sliderValueChanged (Slider* sliderThatWasMoved) { //[UserSliderCode_polyNumberInput] -- add your slider handling code here.. processor.setupVoice(); + editor.resizeWholePanel(); //[/UserSliderCode_polyNumberInput] } @@ -147,6 +156,24 @@ void BasicParamsComponent::sliderValueChanged (Slider* sliderThatWasMoved) //[/UsersliderValueChanged_Post] } +void BasicParamsComponent::buttonClicked (juce::Button* buttonThatWasClicked) +{ + //[UserbuttonClicked_Pre] + //[/UserbuttonClicked_Pre] + + if (buttonThatWasClicked == monoButton.get()) + { + polyNumberInput.get()->setValue(1); + //[UserButtonCode_monoButton] -- add your button handler code here.. + //[/UserButtonCode_monoButton] + } + + //[UserbuttonClicked_Post] + colorSchemeChoice->setVisible (buttonThatWasClicked->getToggleState()); + editor.resizeWholePanel(); + //[/UserbuttonClicked_Post] +} + //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... @@ -156,12 +183,6 @@ void BasicParamsComponent::comboBoxChanged (ComboBox* comboBoxThatHasChanged) editor.resized(); printf ("setup voice!!\n"); } - -void BasicParamsComponent::buttonClicked (Button* buttonThatWasClicked) -{ - colorSchemeChoice->setVisible (buttonThatWasClicked->getToggleState()); - editor.resizeWholePanel(); -} //[/MiscUserCode] @@ -187,7 +208,7 @@ BEGIN_JUCER_METADATA focusDiscardsChanges="0" fontname="Default font" fontsize="15.0" kerning="0.0" bold="0" italic="0" justification="33"/> + virtualName="" explicitFocusOrder="0" pos="0Rr 4 180 28" class="CheckBoxComponent" + params="p, "isAdvancedPanelOpen_raw", "Advanced Options""/> + END_JUCER_METADATA diff --git a/Source/BasicParamsComponent.h b/Source/BasicParamsComponent.h index 3329529..9ab13a4 100644 --- a/Source/BasicParamsComponent.h +++ b/Source/BasicParamsComponent.h @@ -7,12 +7,12 @@ the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. - Created with Projucer version: 5.4.5 + Created with Projucer version: 6.0.8 ------------------------------------------------------------------------------ The Projucer is part of the JUCE library. - Copyright (c) 2017 - ROLI Ltd. + Copyright (c) 2020 - Raw Material Software Limited. ============================================================================== */ @@ -39,24 +39,24 @@ class Magical8bitPlug2AudioProcessorEditor; //[/Comments] */ class BasicParamsComponent : public Component, - public ComboBox::Listener, - public Button::Listener, - public Slider::Listener + public ComboBox::Listener, + public juce::Slider::Listener, + public juce::Button::Listener { public: //============================================================================== BasicParamsComponent (Magical8bitPlug2AudioProcessor& p, Magical8bitPlug2AudioProcessorEditor& e); - ~BasicParamsComponent(); + ~BasicParamsComponent() override; //============================================================================== //[UserMethods] -- You can add your own custom methods in this section. void comboBoxChanged (ComboBox* comboBoxThatHasChanged) override; - void buttonClicked (Button* buttonThatWasClicked) override; //[/UserMethods] - void paint (Graphics& g) override; + void paint (juce::Graphics& g) override; void resized() override; - void sliderValueChanged (Slider* sliderThatWasMoved) override; + void sliderValueChanged (juce::Slider* sliderThatWasMoved) override; + void buttonClicked (juce::Button* buttonThatWasClicked) override; @@ -69,12 +69,13 @@ private: //[/UserVariables] //============================================================================== - std::unique_ptr