-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcomponents_io.cpp
58 lines (43 loc) · 1.15 KB
/
components_io.cpp
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
#include "components.h"
#include "helper_midi.h"
Output::Output() {
this->r = 0;
this->g = 0;
this->b = 0;
this->amp_on = false;
}
// TODO -- functions on output?
void Output::setColor(byte r, byte g, byte b) {
this->r = r;
this->g = g;
this->b = b;
}
void Output::setColorBlack() {
this->r = 0;
this->g = 0;
this->b = 0;
}
void Output::setAmpPower(bool toggle) {
this->amp_on = toggle;
}
InputValues::InputValues(byte lowest_cc) {
this->offset = lowest_cc;
int array_size = (127 - lowest_cc) + 1;
this->input_values = new byte[array_size];
for (int i = 0; i < array_size; i++) {
this->input_values[i] = (byte) 0;
}
};
byte InputValues::getCCIndex(byte control_number) {
return control_number - this->offset;
};
byte InputValues::getValue(byte control_number) {
return this->input_values[getCCIndex(control_number)];
};
void InputValues::storeInput(byte control_number, byte value) {
if (DEBUG) {
MidiOut::WriteMidiCC(control_number, value);
// MidiOut::WriteMidiCC(this->getCCIndex(control_number), value);
}
this->input_values[getCCIndex(control_number)] = value;
};