oscP5 Message Recieved trigger function

edited March 2017 in Library Questions

Hi there i´m sending a message from one to another sketch and i want the receiving sketch to trigger an function everytime it receives a message.

could i call a void oscEvent that only trigger when a new message comes in? or is it easier to make a kind of if statement within draw?

Tagged:

Answers

  • If you are working and modifying the canvas, you should do it within draw(). This is the logic I would use:

    boolean anEvent=false;
    
    void setup(){
      size(400,600);
    }
    
    void draw(){
    
      if(anEvent==true){
    
          (...HERE you add the code related to your received event)
    
          anEvent=false;  //Prepare for next event. Don't forget this step
      }
    }
    
    void your_received_data(){
      anEvent=true;
    }
    

    Where the function your_received_data() refers to the oscEvent() function provided by your OSC session.

    Kf

Sign In or Register to comment.