-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginEditor.cpp
More file actions
147 lines (121 loc) · 5.14 KB
/
Copy pathPluginEditor.cpp
File metadata and controls
147 lines (121 loc) · 5.14 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
==============================================================================
This file contains the basic framework code for a JUCE plugin editor.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
//==============================================================================
CircuitExamplesAudioProcessorEditor::CircuitExamplesAudioProcessorEditor (CircuitExamplesAudioProcessor& 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, 400);
pot1.addListener(this);
pot1.setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
pot1.setBounds(25, 25, 100, 100);
pot1.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 50, 20);
pot1.setRange(0.f, 1.f, 0.001f);
pot1.setValue(0.5f);
addAndMakeVisible(pot1);
pot2.addListener(this);
pot2.setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
pot2.setBounds(25, 150, 100, 100);
pot2.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 50, 20);
pot2.setRange(0.f, 1.f, 0.001f);
pot2.setValue(0.5f);
addAndMakeVisible(pot2);
pot3.addListener(this);
pot3.setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
pot3.setBounds(25, 275, 100, 100);
pot3.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 50, 20);
pot3.setRange(0.f, 1.f, 0.001f);
pot3.setValue(0.5f);
addAndMakeVisible(pot3);
pot4.addListener(this);
pot4.setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
pot4.setBounds(150, 25, 100, 100);
pot4.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 50, 20);
pot4.setRange(0.f, 1.f, 0.001f);
pot4.setValue(0.5f);
addAndMakeVisible(pot4);
pot5.addListener(this);
pot5.setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
pot5.setBounds(150, 150, 100, 100);
pot5.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 50, 20);
pot5.setRange(0.f, 1.f, 0.001f);
pot5.setValue(0.5f);
addAndMakeVisible(pot5);
pot6.addListener(this);
pot6.setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
pot6.setBounds(150, 275, 100, 100);
pot6.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 50, 20);
pot6.setRange(0.f, 1.f, 0.001f);
pot6.setValue(0.5f);
addAndMakeVisible(pot6);
pot7.addListener(this);
pot7.setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
pot7.setBounds(275, 25, 100, 100);
pot7.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 50, 20);
pot7.setRange(0.f, 1.f, 0.001f);
pot7.setValue(0.5f);
addAndMakeVisible(pot7);
pot8.addListener(this);
pot8.setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
pot8.setBounds(275, 150, 100, 100);
pot8.setTextBoxStyle(juce::Slider::TextBoxBelow, false, 50, 20);
pot8.setRange(0.f, 1.f, 0.001f);
pot8.setValue(0.5f);
addAndMakeVisible(pot8);
}
CircuitExamplesAudioProcessorEditor::~CircuitExamplesAudioProcessorEditor()
{
}
//==============================================================================
void CircuitExamplesAudioProcessorEditor::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));
g.setColour (juce::Colours::white);
g.setFont (15.0f);
g.drawFittedText("Pot 1", 25, 8, 100, 25, Justification::centred, 1);
g.drawFittedText("Pot 2", 25, 133, 100, 25, Justification::centred, 1);
g.drawFittedText("Pot 3", 25, 258, 100, 25, Justification::centred, 1);
g.drawFittedText("Pot 4", 150, 8, 100, 25, Justification::centred, 1);
g.drawFittedText("Pot 5", 150, 133, 100, 25, Justification::centred, 1);
g.drawFittedText("Pot 6", 150, 258, 100, 25, Justification::centred, 1);
g.drawFittedText("Pot 7", 275, 8, 100, 25, Justification::centred, 1);
g.drawFittedText("Pot 8", 275, 133, 100, 25, Justification::centred, 1);
}
void CircuitExamplesAudioProcessorEditor::resized()
{
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
}
void CircuitExamplesAudioProcessorEditor::sliderValueChanged(Slider *slider){
if (slider == &pot1){
audioProcessor.pot1 = slider->getValue();
}
if (slider == &pot2){
audioProcessor.pot2 = slider->getValue();
}
if (slider == &pot3){
audioProcessor.pot3 = slider->getValue();
}
if (slider == &pot4){
audioProcessor.pot4 = slider->getValue();
}
if (slider == &pot5){
audioProcessor.pot5 = slider->getValue();
}
if (slider == &pot6){
audioProcessor.pot6 = slider->getValue();
}
if (slider == &pot7){
audioProcessor.pot7 = slider->getValue();
}
if (slider == &pot8){
audioProcessor.pot8 = slider->getValue();
}
}