-
Notifications
You must be signed in to change notification settings - Fork 0
/
MidiController.h
82 lines (64 loc) · 1.68 KB
/
MidiController.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
72
73
74
75
76
77
78
79
80
81
82
#ifndef MidiController_h
#define MidiController_h
#include <MIDI.h>
USING_NAMESPACE_MIDI
namespace MidiController {
/* DEFINITION */
// MidiPreset settings
#define MIDIMESSAGE_MAX 5
#define MIDIPRESET_NAME_MAX 16
// MidiBank settings
#define MIDIBANK_NAME_MAX 16
#define MIDIPRESET_MAX 4
// MidiController settings
#define MIDIBANK_MAX 8
// -----------------------------------------------------------------------------
struct MidiMessage {
MidiType inType;
DataByte inData1;
DataByte inData2;
Channel inChannel;
};
class MidiPreset {
public:
MidiPreset();
bool init(int midimessage_amount);
bool load(int index, MidiType inType, DataByte inData1, DataByte inData2, Channel inChannel);
inline void sendMessage();
int getMidiMessageAmount();
const MidiMessage *getMidiMessage(int index);
private:
char _name[MIDIPRESET_NAME_MAX + 1];
int _midimessage_amount;
MidiMessage _midimessage[MIDIMESSAGE_MAX];
};
class MidiBank {
public:
MidiPreset midipreset[MIDIPRESET_MAX];
MidiBank();
bool init(int midipreset_amount);
int getMidiPresetAmount();
void setName(const char *name);
const char *getName();
private:
char _name[MIDIBANK_NAME_MAX + 1];
int _midipreset_amount;
};
class MidiController {
public:
MidiBank midibank[MIDIBANK_MAX];
MidiController();
void begin();
bool setBankAmount(int midibank_amount);
bool insertBank();
void bankUp();
void bankDown();
void sendMessage(int preset_index);
void test();
int getBankCurrent();
private:
int _midibank_amount;
int _bank_current;
};
}
#endif