Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Sending OSC to multiple addresses

$
0
0

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;
  }
}

Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>