| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- /*
- ==============================================================================
- This file contains the basic framework code for a JUCE plugin editor.
- ==============================================================================
- */
- #include "PluginProcessor.h"
- #include "PluginEditor.h"
- //==============================================================================
- CMLSProjectAudioProcessorEditor::CMLSProjectAudioProcessorEditor (CMLSProjectAudioProcessor& p)
- : AudioProcessorEditor (&p), audioProcessor (p)
- {
- // Make sure that before the constructor has finished, you've set the
- // editor's size to whatever you need it to be.
- setSize (400, 300);
- // equalizer
- this->equalizerLowGainSlider.setRange(0.0, 1.0);
- this->equalizerLowGainSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
- this->equalizerLowGainSlider.addListener(this);
- this->equalizerLowGainLabel.setText("Equalizer Low Gain", juce::dontSendNotification);
- addAndMakeVisible(this->equalizerLowGainSlider);
- addAndMakeVisible(this->equalizerLowGainLabel);
- this->equalizerHighGainSlider.setRange(0.0, 1.0);
- this->equalizerHighGainSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
- this->equalizerHighGainSlider.addListener(this);
- this->equalizerHighGainLabel.setText("Equalizer High Gain", juce::dontSendNotification);
- addAndMakeVisible(this->equalizerHighGainSlider);
- addAndMakeVisible(this->equalizerHighGainLabel);
- // distortion
- this->distortionDriveSlider.setRange(0.0, 1.0);
- this->distortionDriveSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
- this->distortionDriveSlider.addListener(this);
- this->distortionDriveLabel.setText("Distortion Drive", juce::dontSendNotification);
- addAndMakeVisible(this->distortionDriveSlider);
- addAndMakeVisible(this->distortionDriveLabel);
- this->distortionMixSlider.setRange(0.0, 1.0);
- this->distortionMixSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
- this->distortionMixSlider.addListener(this);
- this->distortionMixLabel.setText("Distortion Mix", juce::dontSendNotification);
- addAndMakeVisible(this->distortionMixSlider);
- addAndMakeVisible(this->distortionMixLabel);
- }
- CMLSProjectAudioProcessorEditor::~CMLSProjectAudioProcessorEditor()
- {
- }
- //==============================================================================
- void CMLSProjectAudioProcessorEditor::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));
- }
- void CMLSProjectAudioProcessorEditor::resized()
- {
- // This is generally where you'll want to lay out the positions of any
- // subcomponents in your editor..
- equalizerLowGainSlider.setBounds(130, 10, getWidth() - 130, 20);
- equalizerLowGainLabel.setBounds(10, 10, 100, 20);
- equalizerHighGainSlider.setBounds(130, 30, getWidth() - 130, 20);
- equalizerHighGainLabel.setBounds(10, 30, 100, 20);
- distortionDriveSlider.setBounds(130, 70, getWidth() - 130, 20);
- distortionDriveLabel.setBounds(10, 70, 100, 20);
- distortionMixSlider.setBounds(130, 90, getWidth() - 130, 20);
- distortionMixLabel.setBounds(10, 90, 100, 20);
- }
- void CMLSProjectAudioProcessorEditor::sliderValueChanged(juce::Slider* slider) {
- if (slider == &this->equalizerLowGainSlider)
- {
- this->audioProcessor.setEqLowGain(slider->getValue());
- }
- else if (slider == &this->equalizerHighGainSlider)
- {
- this->audioProcessor.setEqHighGain(slider->getValue());
- }
- else if (slider == &this->distortionDriveSlider)
- {
- this->audioProcessor.setDistortionDrive(slider->getValue());
- }
- else if (slider == &this->distortionMixSlider)
- {
- this->audioProcessor.setDistortionMix(slider->getValue());
- }
- }
|