midibus/ conditionals newb question
in
Contributed Library Questions
•
3 months ago
tryin to parse midi from a controller to do various things in live.. The sketch will compile, however, the if then statement just blocks the noteOn from passing to the OSC command..
import themidibus.*;
import oscP5.*;
import netP5.*;
MidiBus myBus;
OscP5 oscP51;
NetAddress myRemoteLocation1;
OscP5 oscP52;
NetAddress myRemoteLocation2;
void setup() {
size(400,400);
background(0);
smooth();
MidiBus.list();
myBus = new MidiBus(this,1,1);
oscP51 = new OscP5(this,9001);
myRemoteLocation1 = new NetAddress("127.0.0.1",9000);
oscP52 = new OscP5(this,8002);
myRemoteLocation2 = new NetAddress("127.0.0.1",8001);
}
void draw() {
}
void noteOn(int channel, int pitch, int velocity) {
//why doesn't this work
if (channel == 2 && pitch == 12 && velocity == 1) {
OscMessage myMessage = new OscMessage ("/live/play");
myMessage.add(1);
oscP51.send(myMessage, myRemoteLocation1);
}
}
1