Skip to content

Commit b79ec3a

Browse files
authored
Merge pull request #15 from gonski/feature/sendOutputs2Wek
added sendOutputOscToWekinator()
2 parents 5aac846 + cc25153 commit b79ec3a

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

handlerOSC/getMidi.pde

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ void controllerChange(int channel, int number, int value) {
3030
for (int i=0; i<knobCCs.length; i++) {
3131
if (knobCCs[i] == number) {
3232
knobVal[i]=map(value, 0, 127, 0, 1);
33-
println("Knob " + i + " " + knobVal[i]);
33+
//println("Knob " + i + " " + knobVal[i]);
3434
}
3535
}
3636
sendOscMidi2Reaper();
37+
sendOutputOscToWekinator();
3738
}

handlerOSC/menu.pde

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
void drawMidiMenu() {
2-
// from https://github.com/msfeldstein/MidiToOSCBridge/blob/master/MidiOSC.pde
2+
// from https://github.com/msfeldstein/MidiToOSCBridge/blob/master/MidiOSC.pde
33

44
int menuWidth = 100;
55

@@ -115,11 +115,14 @@ void drawTrainingBtns() {
115115
void controlEvent(ControlEvent theEvent) {
116116
// If the event is called FX*, then send OSC to Reaper
117117
// Could be done also for knobs if we create Knob controllers for them
118-
try{
119-
if (theEvent.getName().startsWith("FX")){
118+
try {
119+
if (theEvent.getName().startsWith("FX")) {
120120
//maybe add: if(TrainingToggle==true)
121121
sendOscMidi2Reaper();
122+
sendOutputOscToWekinator();
122123
}
123-
// throws some exceptions at the beginning but then works fine, the catch block is to avoid these exceptions
124-
} catch(NullPointerException e){}
124+
// throws some exceptions at the beginning but then works fine, the catch block is to avoid these exceptions
125+
}
126+
catch(NullPointerException e) {
127+
}
125128
}

handlerOSC/sendOSC.pde

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ void sendTrainingOscToWekinator() {
5656
}
5757
}
5858

59+
void sendOutputOscToWekinator() {
60+
OscMessage msg = new OscMessage("/wekinator/control/outputs");
61+
62+
for (int i=0; i<FXBtns.length; i++) {
63+
msg.add((float)FXBtns[i].getValue());
64+
}
65+
66+
for (int i=0; i<knobCCs.length; i++) {
67+
msg.add((float)knobVal[i]);
68+
}
69+
println(msg);
70+
osc.send(msg, wekAddr); // total 5 FX + 20 dist + 2 xy origin = 27
71+
}
72+
5973

6074

6175
void sendOscWek2Reaper(OscMessage msgWek) {

0 commit comments

Comments
 (0)