Send Long and HashMap via OSC
in
Contributed Library Questions
•
1 year ago
hello,
I got a problem sending a long via OSC. Is there also some way to send
a HashMap with an <Long, PVector> inside via OSC? Following the code
with an simple long = 0:
- import oscP5.*;
- import netP5.*;
- // OSC
- OscP5 oscP5;
- NetAddress myRemoteLocation;
- long ID = 0;
- PVector handPos = new PVector();
- void setup()
- {
- size(640, 480);
- colorMode(HSB, 360, 100, 100);
- background(0, 0, 20);
- // setup OSC
- oscP5 = new OscP5(this,12000);
- myRemoteLocation = new NetAddress("127.0.0.1",12000);
- }
- void draw()
- {
- }
- void mousePressed() {
- /* in the following different ways of creating osc messages are shown by example */
- OscMessage myMessage = new OscMessage("/test");
- myMessage.add(ID); /* add a long array to the osc message */
- /* send the message */
- oscP5.send(myMessage, myRemoteLocation);
- }
- /* incoming osc message are forwarded to the oscEvent method. */
- void oscEvent(OscMessage theOscMessage) {
- /* print the address pattern and the typetag of the received OscMessage */
- print("### received an osc message.");
- print(" addrpattern: "+theOscMessage.addrPattern());
- println(" typetag: "+theOscMessage.typetag());
- println(" value: "+theOscMessage.get(0));
- }
This is the error I get:
OscP5 0.9.8 infos, comments, questions at
http://www.sojamo.de/oscP5
### [2012/5/22 20:34:32] PROCESS @ OscP5 stopped.
### [2012/5/22 20:34:32] PROCESS @ UdpClient.openSocket udp socket initialized.
### [2012/5/22 20:34:33] PROCESS @ UdpServer.start() new Unicast DatagramSocket created @ port 12000
### [2012/5/22 20:34:33] INFO @ OscP5 is running. you (141.45.202.101) are listening @ port 12000
### [2012/5/22 20:34:33] PROCESS @ UdpServer.run() UdpServer is running @ 12000
### received an osc message. addrpattern: /test typetag: f
### [2012/5/22 20:34:35] ERROR @ OscP5 ERROR. an error occured while forwarding an OscMessage
to a method in your program. please check your code for any
possible errors that might occur in the method where incoming
OscMessages are parsed e.g. check for casting errors, possible
nullpointers, array overflows ... .
method in charge : oscEvent java.lang.reflect.InvocationTargetException
1