// Function to send out an OSC message. public void SendOsc(string address, string message) { oscDispatcher1.oscOutAddress = address; // sets the address. oscDispatcher1.ClearData(); // clears the cache. oscDispatcher1.AppendData(message); // add the message. oscDispatcher1.SendOSCMessage(); // send the message. }
void Update() { //only send OSC messages at our specified interval. The _isOSCDirty flag is set at _OnTimedEvent() //lock(_mylock){ // if(!_isOSCDirty)return; // _isOSCDirty = false; //} //Here we change the data of the OSCMessage. oscDispatcher1.UpdateDataAt(0, isDragging); oscDispatcher1.UpdateDataAt(1, controllerXPosition); oscDispatcher1.UpdateDataAt(2, controllerYPosition); oscDispatcher1.UpdateDataAt(3, isPinching); oscDispatcher1.UpdateDataAt(4, controllerScale); oscDispatcher1.UpdateDataAt(5, isTwisting); oscDispatcher1.UpdateDataAt(6, controllerZRotation); oscDispatcher1.UpdateDataAt(7, isDoubleTapped); oscDispatcher1.SendOSCMessage(); //timerToggle = ! timerToggle; }
void Update() { //only send OSC messages at our specified interval. The _isOSCDirty flag is set at _OnTimedEvent() lock (_mylock){ if (!_isOSCDirty) { return; } _isOSCDirty = false; } if (sendData) { //Here we change the data of the OSCMessage. oscDispatcher1.SetDataAtIndex0(timerToggle); oscDispatcher2.SetDataAtIndex0(timerToggle); oscDispatcher1.SendOSCMessage(); oscDispatcher2.SendOSCMessage(); timerToggle = !timerToggle; } }