-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathFilter.cpp
More file actions
70 lines (56 loc) · 2.34 KB
/
Filter.cpp
File metadata and controls
70 lines (56 loc) · 2.34 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
/*
==============================================================================
Filter.cpp
Created: 14 Jan 2018 8:59:36pm
Author: Joshua Hodge
==============================================================================
*/
#include "../JuceLibraryCode/JuceHeader.h"
#include "Filter.h"
//==============================================================================
Filter::Filter(JuceSynthFrameworkAudioProcessor& p) :
processor(p)
{
setSize(200, 200);
filterMenu.addItem("Low Pass", 1);
filterMenu.addItem("High Pass", 2);
filterMenu.addItem("Band Pass", 3);
filterMenu.setJustificationType(Justification::centred);
addAndMakeVisible(&filterMenu);
filterTypeVal = new AudioProcessorValueTreeState::ComboBoxAttachment (processor.tree, "filterType", filterMenu);
filterCutoff.setSliderStyle(Slider::SliderStyle::RotaryHorizontalVerticalDrag);
filterCutoff.setRange(20.0, 10000.0);
filterCutoff.setValue (400.0);
filterCutoff.setTextBoxStyle(Slider::NoTextBox, false, 0, 0);
addAndMakeVisible(&filterCutoff);
filterVal = new AudioProcessorValueTreeState::SliderAttachment (processor.tree, "filterCutoff", filterCutoff);
filterCutoff.setSkewFactorFromMidPoint(1000.0);
filterRes.setSliderStyle(Slider::SliderStyle::RotaryHorizontalVerticalDrag);
filterRes.setRange(1, 5);
filterRes.setValue(1);
filterRes.setTextBoxStyle(Slider::NoTextBox, false, 0, 0);
addAndMakeVisible(&filterRes);
resVal = new AudioProcessorValueTreeState::SliderAttachment (processor.tree, "filterRes", filterRes);
}
Filter::~Filter()
{
}
void Filter::paint (Graphics& g)
{
//background ui stuff
juce::Rectangle<int> titleArea (0, 10, getWidth(), 20);
g.fillAll (Colours::black);
g.setColour(Colours::white);
g.drawText("Filter", titleArea, Justification::centredTop);
juce::Rectangle <float> area (25, 25, 150, 150);
g.setColour(Colours::yellow);
g.drawRoundedRectangle(area, 20.0f, 2.0f);
}
void Filter::resized()
{
//need to come back and dynamically set these...ok for now
juce::Rectangle<int> area = getLocalBounds().reduced(40);
filterMenu.setBounds(area.removeFromTop(20));
filterCutoff.setBounds (30, 100, 70, 70);
filterRes.setBounds (100, 100, 70, 70);
}