I want to send a different OSC message to multiple addresses. However, the code below does not work in the way I expected. What's wrong with my code? When I set just one address, it works fine.
What I want to do is manipulating sounds in a Live Ableton project through OSC.
void ofApp::keyPressed(int key){
// OSC thing
ofxOscMessage m;
if (key == 49) { // 49 = "1"
m.setAddress("/PatternA");
m.addFloatArg(1.0);
// send OSC
sender.sendMessage(m);
m.setAddress("/PatternB");
m.addFloatArg(0.0);
// send OSC
sender.sendMessage(m);
cout << key << endl;
} else if(key == 50) { // 49 = "2"
m.setAddress("/PatternA");
m.addFloatArg(0.0);
// send OSC
sender.sendMessage(m);
m.setAddress("/PatternB");
m.addFloatArg(1.0);
// send OSC
sender.sendMessage(m);
cout << key << endl;
}
}