-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapcKey.h
71 lines (50 loc) · 1.33 KB
/
apcKey.h
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
#pragma once
#include <iostream>
#include <sstream>
#include <vector>
#include <deque>
#include <string>
#include "./RTMidi/RtMidi.h"
enum class akObj {KEY, KNOB, CLIP, SCENE, STOP, STOP_ALL, SUSTAIN, PLAY, REC, SHIFT};
enum class akLight {OFF, GREEN, GREEN_BLIN, RED, RED_BLINK, ORANGE, ORANGE_BLINK};
enum class akButt {PRESSED, RELEASED, MOVED};
struct messApcKey {
akObj obj;
int pos;
int val;
messApcKey(akObj _obj,int _pos, int _val) {
obj = _obj;
pos = _pos;
val = _val;
}
};
class apcKey {
private:
// == Midi
RtMidiIn *midiin;
RtMidiOut *midiout;
bool state;
public:
// == Messages
std::deque<messApcKey> listMess;
// == States
int clip[8 * 5];
int scene[5];
int stop[8];
int knob[8];
// == Button state (being pressed or not)
bool clipPressed[8 * 5];
bool scenePressed[5];
bool stopPressed[8];
bool stopAll;
bool sustain, play, rec, shift;
public:
apcKey();
~apcKey();
void setup();
void reset();
void pollMidi();
void sendMidi(akObj _obj, int _pos, int _val) { sendMidi(messApcKey(_obj, _pos, _val)); }
void sendMidi(messApcKey _mess);
bool isConnected() { return state; };
};