commit 91e20ec28f51681006f9cb3679e48705276e0f0d
parent 7e88326dcabccbfc702d942a58e510fabf647302
Author: jatinchowdhury18 <jatinchowdhury18@users.noreply.github.com>
Date: Sun, 10 Feb 2019 09:21:45 -0800
Add Labels to GUI
Diffstat:
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/Plugin/Source/PluginEditor.cpp b/Plugin/Source/PluginEditor.cpp
@@ -11,8 +11,11 @@ enum
xOffset = 2,
yOffset = 5,
+ labelY = 15,
+ labelHeight = 20,
+
sliderWidth = 110,
- sliderY = 20,
+ sliderY = 25,
overWidth = 65,
tapeWidth = 90,
@@ -33,6 +36,11 @@ ChowtapeModelAudioProcessorEditor::ChowtapeModelAudioProcessorEditor (ChowtapeMo
createComboBox (oversampling, processor.overSampling);
createComboBox (tapeSpeed, processor.tapeSpeed);
+
+ createLabel (inGainLabel, processor.inGain);
+ createLabel (outGainLabel, processor.outGain);
+ createLabel (oversampleLabel, processor.overSampling);
+ createLabel (speedLabel, processor.tapeSpeed);
}
ChowtapeModelAudioProcessorEditor::~ChowtapeModelAudioProcessorEditor()
@@ -79,6 +87,15 @@ void ChowtapeModelAudioProcessorEditor::createComboBox (ComboBox& box, AudioPara
addAndMakeVisible (box);
}
+void ChowtapeModelAudioProcessorEditor::createLabel (Label& label, AudioProcessorParameterWithID* param)
+{
+ label.setText (param->name, dontSendNotification);
+ label.setJustificationType (Justification::centred);
+ label.setColour (Label::textColourId, Colours::antiquewhite);
+ label.setFont (17.0f);
+ addAndMakeVisible (label);
+}
+
//==============================================================================
void ChowtapeModelAudioProcessorEditor::paint (Graphics& g)
{
@@ -91,11 +108,16 @@ void ChowtapeModelAudioProcessorEditor::paint (Graphics& g)
void ChowtapeModelAudioProcessorEditor::resized()
{
+ inGainLabel.setBounds (0, labelY, sliderWidth, labelHeight);
gainInKnob.setBounds (0, sliderY, sliderWidth, sliderWidth);
+ oversampleLabel.setBounds (gainInKnob.getRight() - 7 * xOffset, 3 * labelY + yOffset, tapeWidth, labelHeight);
oversampling.setBounds (gainInKnob.getRight(), boxY, overWidth, boxHeight);
+
+ speedLabel.setBounds (oversampling.getRight(), 3 * labelY + yOffset, tapeWidth, labelHeight);
tapeSpeed.setBounds (oversampling.getRight() + 2 * xOffset, boxY, tapeWidth, boxHeight);
+ outGainLabel.setBounds (tapeSpeed.getRight(), labelY, sliderWidth, labelHeight);
gainOutKnob.setBounds (tapeSpeed.getRight(), sliderY, sliderWidth, sliderWidth);
}
diff --git a/Plugin/Source/PluginEditor.h b/Plugin/Source/PluginEditor.h
@@ -52,8 +52,14 @@ private:
ComboBox oversampling;
ComboBox tapeSpeed;
+ Label inGainLabel;
+ Label outGainLabel;
+ Label oversampleLabel;
+ Label speedLabel;
+
void createSlider (ChowSlider& slide, AudioParameterFloat* param, String suffix = String(), float step = 0.1f);
void createComboBox (ComboBox& box, AudioParameterChoice* choice);
+ void createLabel (Label& label, AudioProcessorParameterWithID* param);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChowtapeModelAudioProcessorEditor)
};
diff --git a/Plugin/Source/PluginProcessor.cpp b/Plugin/Source/PluginProcessor.cpp
@@ -20,10 +20,10 @@ ChowtapeModelAudioProcessor::ChowtapeModelAudioProcessor()
addParameter (outGain = new AudioParameterFloat (String ("outGain"), String ("Output Gain"), -30.0f, 30.0f, 0.0f));
outGain->addListener (this);
- addParameter (overSampling = new AudioParameterChoice (String ("overSampling"), String ("Oversampling"),
+ addParameter (overSampling = new AudioParameterChoice (String ("overSampling"), String ("Upsample"),
StringArray ({ "2x", "4x", "8x" }), 0));
- addParameter (tapeSpeed = new AudioParameterChoice (String ("tapeSpeed"), String ("Tape Speed"),
+ addParameter (tapeSpeed = new AudioParameterChoice (String ("tapeSpeed"), String ("Speed"),
StringArray ({ "3.75 ips", "7.5 ips", "15 ips" }), 1));
}