1
1
#include " Sound/midiMessage.h"
2
2
#include " Arduino.h"
3
3
4
-
5
4
byte last_status;
6
5
7
- void send_channel_message (byte command,
8
- byte channel,
9
- int num_data_bytes,
10
- byte * data)
11
- {
6
+ void send_channel_message (byte command, byte channel, int num_data_bytes, byte *data) {
12
7
// We are assuming that all of the inputs are in a valid range:
13
8
// Acceptable commands are 0x80 to 0xF0.
14
9
// Channels must be between 1 and 16.
@@ -23,25 +18,22 @@ void send_channel_message(byte command,
23
18
// Combine MS-nybble of command with channel nybble.
24
19
first = (command & 0xf0 ) | ((channel - 1 ) & 0x0f );
25
20
26
- if (first != last_status)
27
- {
21
+ if (first != last_status) {
28
22
Serial.write (first);
29
23
last_status = first;
30
24
}
31
25
32
26
// Then send the right number of data bytes
33
- for (int i = 0 ; i < num_data_bytes; i++)
34
- {
27
+ for (int i = 0 ; i < num_data_bytes; i++) {
35
28
Serial.write (data[i]);
36
29
}
37
30
}
38
31
39
- void midiMessage (uint8_t message, uint8_t channel, uint8_t data1, uint8_t data2)
40
- {
41
- uint8_t data[2 ];
42
- data[0 ]=data1;
43
- data[1 ]=data2;
44
-
32
+ void midiMessage (uint8_t message, uint8_t channel, uint8_t data1, uint8_t data2) {
33
+ uint8_t data[2 ];
34
+ data[0 ] = data1;
35
+ data[1 ] = data2;
45
36
46
- // send_channel_message(message,channel,2,data);
37
+ // send_channel_message(message,channel,2,data);
38
+ // Serial.printf("MSG: %u\n", data);
47
39
}
0 commit comments