ameisso / simple-OSC

simple OSC library for particle
Other
7 stars 6 forks source link

Unable to clear message #2

Closed hyshka closed 8 years ago

hyshka commented 8 years ago

Hello,

How do you clear the message once it is sent?

I have tried using the ~OSCMessage(); function on a Photon board but I get the following error:

send-osc.cpp:69:5: error: no match for 'operator~' (operand type is 'OSCMessage')

What is the proper way to clear the outputDatas?

Here's what I am trying to do:

OSCMessage outMessage("/lj/osc/0");
outMessage.addFloat(1);
outMessage.send(udp,outIp,outPort);

delay(1000);

~OSCMessage();
outMessage.addFloat(0);
outMessage.send(udp,outIp,outPort);

delay(1000);

I just want to cycle the first channel on and off. Please advise.

hyshka commented 8 years ago

I just figured out a way to do it: send a completely separate message.

But I'd still like to know if there is a way to clear a current message.

Here's what worked for me:

OSCMessage outMessage("/lj/osc/0");
outMessage.addFloat(1);
outMessage.send(udp,outIp,outPort);

delay(1000);

OSCMessage outMessage2("/lj/osc/0");
outMessage2.addFloat(0);
outMessage2.send(udp,outIp,outPort);

delay(1000);
ameisso commented 8 years ago

hello @hyshka

Your solution is the way I use to do it. I'll try to add the clear function next time I work on it.

If you work on it, you can send a pull request and i'll had it.

Regards Antoine M*