-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathG0ORX_MIDI.cpp
More file actions
121 lines (108 loc) · 2.59 KB
/
G0ORX_MIDI.cpp
File metadata and controls
121 lines (108 loc) · 2.59 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//
// MIDI interface using the USB Host intefrace of the Teensy 4.1
//
// Note currently supports a Behringer CDM Studio 2a
//
// John Melton G0ORX
//
#ifndef BEENHERE
#include "SDT.h"
#endif
#ifdef G0ORX_MIDI
#include "USBHost_t36.h"
USBHost myusb;
MIDIDevice midi(myusb);
void OnNoteOn(byte channel, byte note, byte velocity) {
Serial.print("Note On, ch=");
Serial.print(channel);
Serial.print(", note=");
Serial.print(note);
Serial.print(", velocity=");
Serial.print(velocity);
Serial.println();
switch(note) {
case 6: // PITCH BLEND -
break;
case 7: // PITCH BLEND +
break;
case 36: // UP
ButtonBandIncrease();
break;
case 39: // DOWN
ButtonBandDecrease();
break;
}
}
void OnNoteOff(byte channel, byte note, byte velocity) {
Serial.print("Note Off, ch=");
Serial.print(channel);
Serial.print(", note=");
Serial.print(note);
Serial.println();
}
#define COUNTS 5
static int count=0;
void OnControlChange(byte channel, byte control, byte value) {
//Serial.print("Control Change, ch=");
//Serial.print(channel);
//Serial.print(", control=");
//Serial.print(control);
//Serial.print(", value=");
//Serial.print(value);
//Serial.println();
switch(control) {
case 3: // Left large rotory knob
if(++count==COUNTS) {
//centerTuneFlag = 1; //AFP 10-03-22
if (T41State == CW_XMIT && decoderFlag == DECODE_ON) { // No reason to reset if we're not doing decoded CW AFP 09-27-22
ResetHistograms();
}
centerFreq += (long)freqIncrement * (long)(64-value);
TxRxFreq = centerFreq + NCOFreq;
centerTuneFlag = 1;
count=0;
}
break;
case 5: // left pitch blend rotary
if(value>=65) { // Clockwise
} else if(value<=63) { // Anticlockwise
}
break;
case 19: // left HIGH 0..127
break;
case 20: // left MID 0.127
break;
case 21: // left LOW 0..127
break;
case 24: // A slider 0..127
break;
case 32: // AB Slider 0..127
break;
case 33: // Headphones 0..127
break;
case 53: // right pitch blend rotary
if(value>=65) { // Clockwise
} else if(value<=63) { // Anticlockwise
}
break;
case 67: // right HIGH 0..127
break;
case 68: // right MID 0.127
break;
case 69: // right LOW 0..127
break;
case 72: // B Slider 0..127
break;
}
}
void MIDI_setup() {
myusb.begin();
midi.setHandleNoteOff(OnNoteOff);
midi.setHandleNoteOn(OnNoteOn);
midi.setHandleControlChange(OnControlChange);
}
void MIDI_loop() {
myusb.Task();
midi.read();
}
#endif