-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginEditor.cpp
More file actions
74 lines (59 loc) · 3.42 KB
/
Copy pathPluginEditor.cpp
File metadata and controls
74 lines (59 loc) · 3.42 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
/*
==============================================================================
This file was auto-generated!
It contains the basic framework code for a JUCE plugin editor.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
//==============================================================================
BitCrusherAudioProcessorEditor::BitCrusherAudioProcessorEditor (BitCrusherAudioProcessor& p)
: AudioProcessorEditor (&p), processor (p)
{
addAndMakeVisible(driveSlider = new Slider("Drive"));
driveSlider->setSliderStyle(Slider::Rotary);
driveSlider->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
addAndMakeVisible(rangeSlider = new Slider("Range"));
rangeSlider->setSliderStyle(Slider::Rotary);
rangeSlider->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
addAndMakeVisible(blendSlider = new Slider("Blend"));
blendSlider->setSliderStyle(Slider::Rotary);
blendSlider->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
addAndMakeVisible(volSlider = new Slider("Volume"));
volSlider->setSliderStyle(Slider::Rotary);
volSlider->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
driveAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "drive", *driveSlider);
rangeAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "range", *rangeSlider);
blendAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "blend", *blendSlider);
volAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "volume", *volSlider);
driveSlider->setLookAndFeel(&paintDrive);
rangeSlider->setLookAndFeel(&paintRange);
blendSlider->setLookAndFeel(&paintBlend);
volSlider->setLookAndFeel(&paintVolume);
// 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);
}
BitCrusherAudioProcessorEditor::~BitCrusherAudioProcessorEditor()
{
}
//==============================================================================
void BitCrusherAudioProcessorEditor::paint (Graphics& g)
{
g.fillAll(Colours::black);
g.setColour (Colours::hotpink);
Font AmpFont("Synchro LET", "regular", 30.0f);
g.setFont (AmpFont);
g.drawFittedText ("BitCrusher", getLocalBounds(), Justification::centredTop, 1);
g.drawText("Drive", (((getWidth() / 5) * 1) - (100 / 2)), (getHeight() / 2) + 5, 100, 100, Justification::centred);
g.drawText("Range", (((getWidth() / 5) * 2) - (100 / 2)), (getHeight() / 2) + 5, 100, 100, Justification::centred);
g.drawText("Blend", (((getWidth() / 5) * 3) - (100 / 2)), (getHeight() / 2) + 5, 100, 100, Justification::centred);
g.drawText("Volume", (((getWidth() / 5) * 4) - (100 / 2)), (getHeight() / 2) + 5, 100, 100, Justification::centred);
}
void BitCrusherAudioProcessorEditor::resized()
{
driveSlider->setBounds((((getWidth() / 5) * 1) - (100 / 2)), (getHeight() / 2) - (100 / 2), 100, 100);
rangeSlider->setBounds((((getWidth() / 5) * 2) - (100 / 2)), (getHeight() / 2) - (100 / 2), 100, 100);
blendSlider->setBounds((((getWidth() / 5) * 3) - (100 / 2)), (getHeight() / 2) - (100 / 2), 100, 100);
volSlider->setBounds((((getWidth() / 5) * 4) - (100 / 2)), (getHeight() / 2) - (100 / 2), 100, 100);
}