forked from okyeron/OMX-27
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MM.cpp
59 lines (48 loc) · 1.25 KB
/
MM.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
59
#include "MM.h"
#include <MIDI.h>
namespace {
using SerialMIDI = midi::SerialMIDI<HardwareSerial>;
using MidiInterface = midi::MidiInterface<SerialMIDI>;
SerialMIDI theSerialInstance(Serial1);
MidiInterface HWMIDI(theSerialInstance);
}
namespace MM {
void begin() {
HWMIDI.begin();
}
void sendNoteOn(int note, int velocity, int channel) {
usbMIDI.sendNoteOn(note, velocity, channel);
HWMIDI.sendNoteOn(note, velocity, channel);
}
void sendNoteOff(int note, int velocity, int channel) {
usbMIDI.sendNoteOff(note, velocity, channel);
HWMIDI.sendNoteOff(note, velocity, channel);
}
void sendControlChange(int control, int value, int channel) {
usbMIDI.sendControlChange(control, value, channel);
HWMIDI.sendControlChange(control, value, channel);
}
void sendClock() {
usbMIDI.sendRealTime(usbMIDI.Clock);
HWMIDI.sendClock();
}
void startClock(){
usbMIDI.sendRealTime(usbMIDI.Start);
HWMIDI.sendStart();
}
void continueClock(){
usbMIDI.sendRealTime(usbMIDI.Continue);
HWMIDI.sendContinue();
}
void stopClock(){
usbMIDI.sendRealTime(usbMIDI.Stop);
HWMIDI.sendStop();
}
// NEED SOMETHING FOR usbMIDI.read() / MIDI.read()
bool usbMidiRead(){
return usbMIDI.read();
}
bool midiRead(){
return HWMIDI.read();
}
}