annotate BassPedalRackPlugin/PluginEditor.cpp @ 2:13ec2fa02a26 tip

(none)
author Yannick JACOB <y.jacob@se12.qmul.ac.uk>
date Tue, 03 Sep 2013 15:33:42 +0100
parents 2cd427e000b0
children
rev   line source
y@0 1 /*
y@0 2 ==============================================================================
y@0 3
y@0 4 This file was auto-generated by the Introjucer!
y@0 5
y@0 6 It contains the basic startup code for a Juce application.
y@0 7
y@0 8 ==============================================================================
y@0 9 */
y@0 10
y@0 11 #include "PluginProcessor.h"
y@0 12 #include "PluginEditor.h"
y@0 13
y@0 14
y@0 15 //==============================================================================
y@0 16 BassPedalRackProcessorEditor::BassPedalRackProcessorEditor (BassPedalRackProcessor* ownerFilter)
y@0 17 : AudioProcessorEditor (ownerFilter),
y@0 18
y@0 19
y@0 20 lowCutLabel_("","LowCut:"),
y@0 21 lowCutSlider_("lowcut"),
y@0 22 highCutLabel_("","HighCut:"),
y@0 23 highCutSlider_("highcut"),
y@0 24
y@0 25 indexLabel_("", "Index:"),
y@0 26 indexSlider_("index"),
y@0 27 gain1Label_("", "Gain1:"),
y@0 28 gain1Slider_("gain1"),
y@0 29 gain2Label_("", "Gain2:"),
y@0 30 gain2Slider_("gain2"),
y@0 31 gain3Label_("", "Gain3:"),
y@0 32 gain3Slider_("gain3"),
y@0 33 gain4Label_("", "Gain4:"),
y@0 34 gain4Slider_("gain4"),
y@0 35 gain5Label_("", "Gain5:"),
y@0 36 gain5Slider_("gain5"),
y@0 37 gain6Label_("", "Gain6:"),
y@0 38 gain6Slider_("gain6"),
y@0 39 gain7Label_("", "Gain7:"),
y@0 40 gain7Slider_("gain7"),
y@0 41 gain8Label_("", "Gain8:"),
y@0 42 gain8Slider_("gain8"),
y@0 43 gain9Label_("", "Gain9:"),
y@0 44 gain9Slider_("gain9"),
y@0 45
y@0 46 mixLabel_("", "Mix:"),
y@0 47 mixSlider_("mix"),
y@0 48
y@0 49 gainTreLabel_("", "Treble:"),
y@0 50 gainTreSlider_("treble"),
y@0 51 gainLowLabel_("", "Low:"),
y@0 52 gainLowSlider_("low"),
y@0 53 gainMidLabel_("", "Mid:"),
y@0 54 gainMidSlider_("mid"),
y@0 55
y@0 56 gainLabel_("", "Gain:"),
y@0 57 gainSlider_("gain")
y@0 58 {
y@0 59 // This is where our plugin's editor size is set.
y@0 60 // setSize(170, 80);
y@0 61
y@0 62 // Set up the sliders
y@0 63 addAndMakeVisible(&lowCutSlider_); lowCutSlider_.setSliderStyle(Slider::Rotary); lowCutSlider_.addListener(this);
y@0 64 lowCutSlider_.setRange(0, 10, 1); lowCutLabel_.attachToComponent(&lowCutSlider_, false); lowCutLabel_.setFont(Font (11.0f));
y@0 65
y@0 66 addAndMakeVisible(&highCutSlider_); highCutSlider_.setSliderStyle(Slider::Rotary); highCutSlider_.addListener(this);
y@0 67 highCutSlider_.setRange(0, 10, 1); highCutLabel_.attachToComponent(&highCutSlider_, false); highCutLabel_.setFont(Font (11.0f));
y@0 68
y@0 69 addAndMakeVisible(&indexSlider_); indexSlider_.setSliderStyle(Slider::Rotary); indexSlider_.addListener(this);
y@0 70 indexSlider_.setRange(0.0, 5.0, 0.01); indexLabel_.attachToComponent(&indexSlider_, false); indexLabel_.setFont(Font (11.0f));
y@0 71
y@0 72 addAndMakeVisible(&gain1Slider_); gain1Slider_.setSliderStyle(Slider::Rotary); gain1Slider_.addListener(this);
y@0 73 gain1Slider_.setRange(0.0, 5.0, 0.01); gain1Label_.attachToComponent(&gain1Slider_, false); gain1Label_.setFont(Font (11.0f));
y@0 74 addAndMakeVisible(&gain2Slider_); gain2Slider_.setSliderStyle(Slider::Rotary); gain2Slider_.addListener(this);
y@0 75 gain2Slider_.setRange(0.0, 5.0, 0.01); gain2Label_.attachToComponent(&gain2Slider_, false); gain2Label_.setFont(Font (11.0f));
y@0 76 addAndMakeVisible(&gain3Slider_); gain3Slider_.setSliderStyle(Slider::Rotary); gain3Slider_.addListener(this);
y@0 77 gain3Slider_.setRange(0.0, 5.0, 0.01); gain3Label_.attachToComponent(&gain3Slider_, false); gain3Label_.setFont(Font (11.0f));
y@0 78 addAndMakeVisible(&gain4Slider_); gain4Slider_.setSliderStyle(Slider::Rotary); gain4Slider_.addListener(this);
y@0 79 gain4Slider_.setRange(0.0, 5.0, 0.01); gain4Label_.attachToComponent(&gain4Slider_, false); gain4Label_.setFont(Font (11.0f));
y@0 80 addAndMakeVisible(&gain5Slider_); gain5Slider_.setSliderStyle(Slider::Rotary); gain5Slider_.addListener(this);
y@0 81 gain5Slider_.setRange(0.0, 5.0, 0.01); gain5Label_.attachToComponent(&gain5Slider_, false); gain5Label_.setFont(Font (11.0f));
y@0 82 addAndMakeVisible(&gain6Slider_); gain6Slider_.setSliderStyle(Slider::Rotary); gain6Slider_.addListener(this);
y@0 83 gain6Slider_.setRange(0.0, 5.0, 0.01); gain6Label_.attachToComponent(&gain6Slider_, false); gain6Label_.setFont(Font (11.0f));
y@0 84 addAndMakeVisible(&gain7Slider_); gain7Slider_.setSliderStyle(Slider::Rotary); gain7Slider_.addListener(this);
y@0 85 gain7Slider_.setRange(0.0, 5.0, 0.01); gain7Label_.attachToComponent(&gain7Slider_, false); gain7Label_.setFont(Font (11.0f));
y@0 86 addAndMakeVisible(&gain8Slider_); gain8Slider_.setSliderStyle(Slider::Rotary); gain8Slider_.addListener(this);
y@0 87 gain8Slider_.setRange(0.0, 5.0, 0.01); gain8Label_.attachToComponent(&gain8Slider_, false); gain8Label_.setFont(Font (11.0f));
y@0 88 addAndMakeVisible(&gain9Slider_); gain9Slider_.setSliderStyle(Slider::Rotary); gain9Slider_.addListener(this);
y@0 89 gain9Slider_.setRange(0.0, 5.0, 0.01); gain9Label_.attachToComponent(&gain9Slider_, false); gain9Label_.setFont(Font (11.0f));
y@0 90
y@0 91
y@0 92 addAndMakeVisible(&mixSlider_); mixSlider_.setSliderStyle(Slider::Rotary); mixSlider_.addListener(this);
y@0 93 mixSlider_.setRange(0.0, 1.0, 0.001); mixLabel_.attachToComponent(&mixSlider_, false); mixLabel_.setFont(Font (11.0f));
y@0 94
y@0 95 addAndMakeVisible(&gainTreSlider_); gainTreSlider_.setSliderStyle(Slider::Rotary); gainTreSlider_.addListener(this);
y@0 96 gainTreSlider_.setRange(0.0, 1.0, 0.001); gainTreLabel_.attachToComponent(&gainTreSlider_, false); gainTreLabel_.setFont(Font (11.0f));
y@0 97 addAndMakeVisible(&gainMidSlider_); gainMidSlider_.setSliderStyle(Slider::Rotary); gainMidSlider_.addListener(this);
y@0 98 gainMidSlider_.setRange(0.0, 1.0, 0.001); gainMidLabel_.attachToComponent(&gainMidSlider_, false); gainMidLabel_.setFont(Font (11.0f));
y@0 99 addAndMakeVisible(&gainLowSlider_); gainLowSlider_.setSliderStyle(Slider::Rotary); gainLowSlider_.addListener(this);
y@0 100 gainLowSlider_.setRange(0.0, 1.0, 0.001); gainLowLabel_.attachToComponent(&gainLowSlider_, false); gainLowLabel_.setFont(Font (11.0f));
y@0 101
y@0 102 addAndMakeVisible(&gainSlider_); gainSlider_.setSliderStyle(Slider::Rotary); gainSlider_.addListener(this);
y@0 103 gainSlider_.setRange(0.0, 10.0, 0.001); gainLabel_.attachToComponent(&gainSlider_, false); gainLabel_.setFont(Font (11.0f));
y@0 104
y@0 105 // add the triangular resizer component for the bottom-right of the UI
y@0 106 addAndMakeVisible(resizer_ = new ResizableCornerComponent (this, &resizeLimits_));
y@0 107 resizeLimits_.setSizeLimits(300, 200, 800, 600);
y@0 108
y@0 109 // set our component's initial size to be the last one that was stored in the filter's settings
y@0 110 setSize(ownerFilter->lastUIWidth_,
y@0 111 ownerFilter->lastUIHeight_);
y@0 112
y@0 113 startTimer(50);
y@0 114 }
y@0 115
y@0 116 BassPedalRackProcessorEditor::~BassPedalRackProcessorEditor()
y@0 117 {
y@0 118 }
y@0 119
y@0 120 //==============================================================================
y@0 121 void BassPedalRackProcessorEditor::paint (Graphics& g)
y@0 122 {
y@0 123 g.fillAll (Colours::grey);
y@0 124 }
y@0 125
y@0 126 void BassPedalRackProcessorEditor::resized()
y@0 127 {
y@0 128
y@0 129 lowCutSlider_.setBounds(20, 20, 150, 40);
y@0 130 highCutSlider_.setBounds(200, 20, 150, 40);
y@0 131 mixSlider_.setBounds(380, 20, 150, 40);
y@0 132
y@0 133 indexSlider_.setBounds(200, 75, 150, 40);
y@0 134 gain1Slider_.setBounds(380, 75, 150, 40);
y@0 135 gain2Slider_.setBounds(200, 130, 150, 40);
y@0 136 gain3Slider_.setBounds(380, 130, 150, 40);
y@0 137 gain4Slider_.setBounds(200, 185, 150, 40);
y@0 138 gain5Slider_.setBounds(380, 185, 150, 40);
y@0 139 gain6Slider_.setBounds(200, 240, 150, 40);
y@0 140 gain7Slider_.setBounds(380, 240, 150, 40);
y@0 141 gain8Slider_.setBounds(200, 295, 150, 40);
y@0 142 gain9Slider_.setBounds(380, 295, 150, 40);
y@0 143
y@0 144
y@0 145
y@0 146
y@0 147 gainTreSlider_.setBounds(20,185,150, 40);
y@0 148 gainMidSlider_.setBounds(20,240,150, 40);
y@0 149 gainLowSlider_.setBounds(20,295,150, 40);
y@0 150
y@0 151 gainSlider_.setBounds(20, 75, 150, 40);
y@0 152
y@0 153 resizer_->setBounds(getWidth() - 16, getHeight() - 16, 16, 16);
y@0 154
y@0 155 getProcessor()->lastUIWidth_ = getWidth();
y@0 156 getProcessor()->lastUIHeight_ = getHeight();
y@0 157 }
y@0 158
y@0 159 //==============================================================================
y@0 160 // This timer periodically checks whether any of the filter's parameters have changed...
y@0 161 void BassPedalRackProcessorEditor::timerCallback()
y@0 162 {
y@0 163 BassPedalRackProcessor* ourProcessor = getProcessor();
y@0 164
y@0 165 mixSlider_.setValue(ourProcessor->mix_, dontSendNotification);
y@0 166 indexSlider_.setValue(ourProcessor->index_, dontSendNotification);
y@0 167 gainSlider_.setValue(ourProcessor->gain_, dontSendNotification);
y@0 168 lowCutSlider_.setValue(ourProcessor->lowCut_, dontSendNotification);
y@0 169 highCutSlider_.setValue(ourProcessor->highCut_, dontSendNotification);
y@0 170 gainLowSlider_.setValue(ourProcessor->bassGain_, dontSendNotification);
y@0 171 gainMidSlider_.setValue(ourProcessor->midGain_, dontSendNotification);
y@0 172 gainTreSlider_.setValue(ourProcessor->trebleGain_, dontSendNotification);
y@0 173 gain1Slider_.setValue(ourProcessor->gain1_, dontSendNotification);
y@0 174 gain2Slider_.setValue(ourProcessor->gain2_, dontSendNotification);
y@0 175 gain3Slider_.setValue(ourProcessor->gain3_, dontSendNotification);
y@0 176 gain4Slider_.setValue(ourProcessor->gain4_, dontSendNotification);
y@0 177 gain5Slider_.setValue(ourProcessor->gain5_, dontSendNotification);
y@0 178 gain6Slider_.setValue(ourProcessor->gain6_, dontSendNotification);
y@0 179 gain7Slider_.setValue(ourProcessor->gain7_, dontSendNotification);
y@0 180 gain8Slider_.setValue(ourProcessor->gain8_, dontSendNotification);
y@0 181 gain9Slider_.setValue(ourProcessor->gain9_, dontSendNotification);
y@0 182 }
y@0 183
y@0 184 // This is our Slider::Listener callback, when the user drags a slider.
y@0 185 void BassPedalRackProcessorEditor::sliderValueChanged (Slider* slider)
y@0 186 {
y@0 187 if (slider == &mixSlider_){
y@0 188 // It's vital to use setParameterNotifyingHost to change any parameters that are automatable
y@0 189 // by the host, rather than just modifying them directly, otherwise the host won't know
y@0 190 // that they've changed.
y@0 191 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kMixParam,(float)mixSlider_.getValue());}
y@0 192 if (slider == &lowCutSlider_){
y@0 193 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kLowCutParam,(float)lowCutSlider_.getValue());}
y@0 194 if (slider == &highCutSlider_){
y@0 195 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kHighCutParam,(float)highCutSlider_.getValue());}
y@0 196 if (slider == &indexSlider_){
y@0 197 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kIndexParam,(float)indexSlider_.getValue());}
y@0 198 if (slider == &gainSlider_){
y@0 199 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGainParam,(float)gainSlider_.getValue());}
y@0 200 if (slider == &gainMidSlider_){
y@0 201 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGainMidParam,(float)gainMidSlider_.getValue());}
y@0 202 if (slider == &gainLowSlider_){
y@0 203 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGainLowParam,(float)gainLowSlider_.getValue());}
y@0 204 if (slider == &gainTreSlider_){
y@0 205 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGainTreParam,(float)gainTreSlider_.getValue());}
y@0 206 if (slider == &gain1Slider_){
y@0 207 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGain1Param,(float)gain1Slider_.getValue());}
y@0 208 if (slider == &gain2Slider_){
y@0 209 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGain2Param,(float)gain2Slider_.getValue());}
y@0 210 if (slider == &gain3Slider_){
y@0 211 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGain3Param,(float)gain3Slider_.getValue());}
y@0 212 if (slider == &gain4Slider_){
y@0 213 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGain4Param,(float)gain4Slider_.getValue());}
y@0 214 if (slider == &gain5Slider_){
y@0 215 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGain5Param,(float)gain5Slider_.getValue());}
y@0 216 if (slider == &gain6Slider_){
y@0 217 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGain6Param,(float)gain6Slider_.getValue());}
y@0 218 if (slider == &gain7Slider_){
y@0 219 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGain7Param,(float)gain7Slider_.getValue());}
y@0 220 if (slider == &gain8Slider_){
y@0 221 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGain8Param,(float)gain8Slider_.getValue());}
y@0 222 if (slider == &gain9Slider_){
y@0 223 getProcessor()->setParameterNotifyingHost (BassPedalRackProcessor::kGain9Param,(float)gain9Slider_.getValue());}
y@0 224 }