-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPluginEditor.cpp
More file actions
92 lines (74 loc) · 3.57 KB
/
PluginEditor.cpp
File metadata and controls
92 lines (74 loc) · 3.57 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
/*
==============================================================================
This file contains the basic framework code for a JUCE plugin editor.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
#include "math.h"
//==============================================================================
SoundStageAudioProcessorEditor::SoundStageAudioProcessorEditor (SoundStageAudioProcessor& 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.
// ELEVATION SLIDER SETTINGS
elevationControl.setSliderStyle(juce::Slider::SliderStyle::LinearVertical);
elevationControl.setRange(-45.f, 90.f, 5.f);
elevationControl.setValue(0.f);
elevationControl.setTextBoxStyle(juce::Slider::TextBoxLeft, 0, 50, 25);
elevationControl.addListener(this);
addAndMakeVisible(elevationControl);
// AZIMUTH SLIDER SETTINGS
azimuthControl.setSliderStyle(juce::Slider::SliderStyle::Rotary);
azimuthControl.setRange(0.f, 360.f, 1.f);
azimuthControl.setRotaryParameters(0.f, 4 * acos(0.0f), 0);
azimuthControl.setTextBoxStyle(juce::Slider::TextBoxBelow, 0, 50, 25);
azimuthControl.addListener(this);
addAndMakeVisible(azimuthControl);
// LABEL SETTINGS
azLabel.setText("AZIMUTH", juce::NotificationType::dontSendNotification);
elLabel.setText("ELEVATION", juce::NotificationType::dontSendNotification);
azLabel.setEditable(false);
elLabel.setEditable(false);
azLabel.setJustificationType(juce::Justification::centred);
azLabel.attachToComponent(&azimuthControl, false);
elLabel.attachToComponent(&elevationControl, true);
addAndMakeVisible(azLabel);
addAndMakeVisible(elLabel);
// COLOR SCHEME SETTINGS
getLookAndFeel().setColour(juce::Slider::thumbColourId, juce::Colours::purple);
getLookAndFeel().setColour(juce::Slider::trackColourId, juce::Colours::white);
getLookAndFeel().setColour(juce::Slider::rotarySliderFillColourId, juce::Colours::white);
getLookAndFeel().setColour(juce::Slider::backgroundColourId, juce::Colours::black);
getLookAndFeel().setColour(juce::Slider::rotarySliderOutlineColourId, juce::Colours::black);
getLookAndFeel().setColour(juce::ResizableWindow::backgroundColourId, juce::Colours::darkgrey);
setSize (400, 300);
}
SoundStageAudioProcessorEditor::~SoundStageAudioProcessorEditor()
{
}
//==============================================================================
void SoundStageAudioProcessorEditor::paint (juce::Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
juce::ColourGradient grad1(juce::Colours::darkgrey, 200, 150, juce::Colours::black, 600, 400, 1);
g.setGradientFill(grad1);
g.fillAll();
}
void SoundStageAudioProcessorEditor::resized()
{
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
elevationControl.setBounds(3 * getWidth() / 4, getHeight()/8, 100, 3 * getHeight() / 4);
azimuthControl.setBounds(0, 65, 200, 200);
}
void SoundStageAudioProcessorEditor::sliderValueChanged(juce::Slider* slider)
{
if (slider == &elevationControl) {
audioProcessor.elevation = elevationControl.getValue();
}
if (slider == &azimuthControl) {
audioProcessor.azimuth = azimuthControl.getValue();
}
}