Lucky for me, I just happen to have 4 Wii motes laying around here.
I got one up and running with OSCulator.
Expanding on the supplied OSCulator example code from Chuck, I have come up with:
=================
The issue I have is that I don't know how to pick off the message parameter that presumably lets me know whether this was a button press or release event. I tried using getFloat() on the msg, but this method is not supported for that class.
I found some other examples that use a different OSC message class.
===================
The challenge I have here is this:
Well, "wii/1/button/B" or "/wii/1/button/B" are not the correct values to put in there. The examples I've found that use this presume that you are programmatically creating the messages, but in this case OSCulator is doing it. I bought the eBook for Chuck hoping to get some clarity, however it just uses the same examples here and so I'm stuck.
Thanks for any guidance!
DL
I got one up and running with OSCulator.
Expanding on the supplied OSCulator example code from Chuck, I have come up with:
Code:
OscIn oin; // make an OSC receiver 6449 => oin.port; // set port # oin.listenAll(); // any message at all OscMsg msg; // message holder // OSC msg catch and parsing loop while (true) { oin => now; // wait for any OSC 0 => int id; while (oin.recv(msg)) { << < "got message:", msg.address, msg.typetag >>> ; if (msg.address == "/wii/1/button/B") { if (msg.typetag == "f") // msg.getFloat() => float f; // <<< "Argument", f >>>; // do_something(); } if (msg.address == "/wii/1/button/A") { // do_something_else() } if (msg.address == "/wii/1/button/1") { // do_something_3(); } if (msg.address == "/wii/1/button/2") { // do_something_4(); } } }
The issue I have is that I don't know how to pick off the message parameter that presumably lets me know whether this was a button press or release event. I tried using getFloat() on the msg, but this method is not supported for that class.
I found some other examples that use a different OSC message class.
Code:
// (launch with s.ck) // the patch SinOsc s => JCRev r => dac; .5 => s.gain; .1 => r.mix; // create our OSC receiver OscRecv recv; // use port 6449 (or whatever) 6449 => recv.port; // start listening (launch thread) recv.listen(); [B]// create an address in the receiver, store in new variable recv.event("wii/1/button/B, f") @ => OscEvent @ oe;[/B] // infinite event loop while (true) { // wait for event to arrive oe => now; // grab the next message from the queue. while (oe.nextMsg()) { // int i; float f; // getFloat fetches the expected float (as indicated by "i f") // oe.getInt() => i => Std.mtof => s.freq; oe.getFloat() => f => s.gain; // print << < "got (via OSC):", f >>> ; } }
The challenge I have here is this:
Code:
[B]// create an address in the receiver, store in new variable[/B] [B]recv.event( "wii/1/button/B, f" ) @=> OscEvent @ oe;[/B]
Thanks for any guidance!
DL
Comment