-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilterbox.cpp
More file actions
78 lines (62 loc) · 2.74 KB
/
filterbox.cpp
File metadata and controls
78 lines (62 loc) · 2.74 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
#include "filterbox.h"
FilterBox::FilterBox(Filter *filter, LFO *lfo, NoteFactory *noteFactory,
QWidget *parent)
: QGroupBox(parent), filter(filter), lfo(lfo), noteFactory(noteFactory),
filterLabel(this), cutoffSelect(this), cutoffLabel(this),
resonanceSelect(this), resonanceLabel(this), cutoffLfoLabel(this),
cutoffLfoAmountSelect(this), cutoffEnvLabel(this),
cutoffEnvAmountSelect(this)
{
filter->addLfoConnection(new LfoConnection(lfo, 0));
filterLabel.setText("Filter");
cutoffSelect.setRange(1, 1000);
cutoffLabel.setText("Cutoff");
cutoffSelect.setValue(1000);
resonanceSelect.setRange(0, 100);
resonanceLabel.setText("Res.");
resonanceSelect.setValue(0);
cutoffLfoAmountSelect.setRange(0, 100);
cutoffLfoLabel.setText("LFO");
cutoffLfoAmountSelect.setValue(0);
cutoffEnvAmountSelect.setRange(0, 100);
cutoffEnvLabel.setText("Env.");
cutoffEnvAmountSelect.setValue(0);
layout.addWidget(&filterLabel, 0, 0, 1, -1);
layout.addWidget(&cutoffSelect, 1, 0, 1, 1);
layout.addWidget(&cutoffLabel, 2, 0, 1, 1, Qt::AlignHCenter);
layout.addWidget(&resonanceSelect, 1, 1, 1, 1);
layout.addWidget(&resonanceLabel, 2, 1, 1, 1, Qt::AlignHCenter);
layout.addWidget(&cutoffLfoAmountSelect, 1, 2, 1, 1);
layout.addWidget(&cutoffLfoLabel, 2, 2, 1, 1, Qt::AlignHCenter);
layout.addWidget(&cutoffEnvAmountSelect, 1, 3, 1, 1);
layout.addWidget(&cutoffEnvLabel, 2, 3, 1, 1, Qt::AlignHCenter);
this->setLayout(&layout);
QObject::connect(&cutoffSelect, SIGNAL(valueChanged(int)), this,
SLOT(setCutoff(int)));
QObject::connect(&cutoffSelect, SIGNAL(valueChanged(int)), this,
SLOT(setFocus()));
QObject::connect(&resonanceSelect, SIGNAL(valueChanged(int)), this,
SLOT(setResonance(int)));
QObject::connect(&resonanceSelect, SIGNAL(valueChanged(int)), this,
SLOT(setFocus()));
QObject::connect(&cutoffLfoAmountSelect, SIGNAL(valueChanged(int)), this,
SLOT(setCutoffLfoAmount(int)));
QObject::connect(&cutoffLfoAmountSelect, SIGNAL(valueChanged(int)), this,
SLOT(setFocus()));
QObject::connect(&cutoffEnvAmountSelect, SIGNAL(valueChanged(int)), this,
SLOT(setCutoffEnvAmount(int)));
QObject::connect(&cutoffEnvAmountSelect, SIGNAL(valueChanged(int)), this,
SLOT(setFocus()));
}
void FilterBox::setCutoff(int value) {
filter->setCutoff(((double)value) / 1000);
}
void FilterBox::setResonance(int value) {
filter->setResonance(((double)value) / 100);
}
void FilterBox::setCutoffLfoAmount(int i) {
filter->setLfoAmount(((double)i) / 100);
}
void FilterBox::setCutoffEnvAmount(int i) {
noteFactory->setFilterEnvAmount(((double)i) / 100);
}