-
Notifications
You must be signed in to change notification settings - Fork 0
/
PluginEditor.cpp
67 lines (53 loc) · 2.91 KB
/
PluginEditor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
==============================================================================
This file was auto-generated!
It contains the basic framework code for a JUCE plugin editor.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
//==============================================================================
DistortionVstAudioProcessorEditor::DistortionVstAudioProcessorEditor (DistortionVstAudioProcessor& p)
: AudioProcessorEditor (&p), processor (p)
{
addAndMakeVisible(driveKnob = new Slider("Drive"));
driveKnob->setSliderStyle(Slider::Rotary);
driveKnob->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
addAndMakeVisible(rangeKnob = new Slider("Range"));
rangeKnob->setSliderStyle(Slider::Rotary);
rangeKnob->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
addAndMakeVisible(blendKnob = new Slider("Blend"));
blendKnob->setSliderStyle(Slider::Rotary);
blendKnob->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
addAndMakeVisible(volumeKnob = new Slider("Volume"));
volumeKnob->setSliderStyle(Slider::Rotary);
volumeKnob->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
driveAttatchment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "drive", *driveKnob);
driveAttatchment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "range", *rangeKnob);
driveAttatchment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "blend", *blendKnob);
driveAttatchment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "volume", *volumeKnob);
// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
setSize (500, 200);
}
DistortionVstAudioProcessorEditor::~DistortionVstAudioProcessorEditor()
{
}
//==============================================================================
void DistortionVstAudioProcessorEditor::paint (Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
g.setColour (Colours::white);
g.setFont (15.0f);
//g.drawFittedText ("Hello World!", getLocalBounds(), Justification::centred, 1);
}
void DistortionVstAudioProcessorEditor::resized()
{
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
driveKnob->setBounds(((getWidth() / 5) * 1) - (100 /2), (getHeight() / 2) - (100 / 2), 100, 100);
rangeKnob->setBounds(((getWidth() / 5) * 2) - (100 / 2), (getHeight() / 2) - (100 / 2), 100, 100);
blendKnob->setBounds(((getWidth() / 5) * 3) - (100 / 2), (getHeight() / 2) - (100 / 2), 100, 100);
volumeKnob->setBounds(((getWidth() / 5) * 4) - (100 / 2), (getHeight() / 2) - (100 / 2), 100, 100);
}