Dominik Hildebrand Marques Lopes
2014-10-20 15:16:37 UTC
Hi list,
I just reported an issue (#1210) on supercollider github. Maybe someone has an idea on why this happens. I tested the code below on different SC versions and computers, so it seems to be not related to my personal configuration.
Thanks in advance!
Best, Dominik
The below code provokes an error in recvOSCmessage.
When the error occurs, the msg argument in recvOSCmessage is erroneously replaced by the list of all the arguments to recvOSCmessage.
Circumstances that provoke the error:
+ When msg is an Int8Array,
+ the data rate is at ca. 100 Hz,
+ and when much posting happens, e.g. every message,
+ and about every 100th time
````
// TEST CODE to reproduce the error
// (comes from sending arduinoSMS data via Xosc board)
(
q = q ?? ();
q.col = \green;
// happens both with direct NetAddr and broadcasting :
// NetAddr.broadcastFlag_(true);
// q.sender = NetAddr("255.255.255.255", 57120);
q.sender = NetAddr.localAddr;
OSCdef(q.col , {|msg|
// only post once every 2.5 secs - error happens very rarely
// if (msg[1][0] == 0) { msg.postln; };
// post every message, error is about 1/sec!
msg.postln;
}, q.col);
// send test messages:
Tdef(\oscTest, {
inf.do{|i|
q.sender.sendMsg(q.col,
// error happens with Int8Array:
Int8Array.rand(4, 32, 96).put(0, i.asInteger),
// while standard list of args works fine:
// i, 0, 0
);
0.01.wait; //100Hz sending rate
};
});
Tdef(\oscTest).play;
)
Tdef(\oscTest).stop;
Tdef(\oscTest).play;
Tdef(\oscTest).gui;
````
This addition helps to catch the error in the primitive that calls ````recvOSCmessage````
````
/* Usually, the debug line inserted in recvOSCmessage:
// [time, replyAddr, recvPort, msg].postln;
// posts the correct arguments, with test code:
[ 782.696896803, a NetAddr(127.0.0.1, 57120), 57120, [ /green, Int8Array[ -39, 53, 33, 53 ] ] ]
// while, when the error occurs, the args are :
[ 782.70763823, Int8Array[ -38, 35, 44, 86 ], 57120, [ 782.70763823, Int8Array[ -38, 35, 44, 86 ], 57120, [ 782.70763823, Int8Array[ -38, 35, 44, 86 ], 57120, ...etc...
which is listOfAllArgs.putLast(listOfAllArgs).
*/
+ Main {
recvOSCmessage { arg time, replyAddr, recvPort, msg;
// [time, replyAddr, recvPort, msg].postln;
// msg.postln;
if (msg.isKindOf(Array).not) {
"OSC glitch in % : msg is: \n\t%".format(
thisMethod, msg.asCompileString).inform;
"jumping out before recvOSCfunc etc.".postln;
// "msg.dump: ".postln; msg.dump;
^this
};
// this method is called when an OSC message is received.
recvOSCfunc.value(time, replyAddr, msg);
prRecvOSCFunc.value(msg, time, replyAddr, recvPort); // same order as OSCFunc
OSCresponder.respond(time, replyAddr, msg);
}
}
````
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
I just reported an issue (#1210) on supercollider github. Maybe someone has an idea on why this happens. I tested the code below on different SC versions and computers, so it seems to be not related to my personal configuration.
Thanks in advance!
Best, Dominik
The below code provokes an error in recvOSCmessage.
When the error occurs, the msg argument in recvOSCmessage is erroneously replaced by the list of all the arguments to recvOSCmessage.
Circumstances that provoke the error:
+ When msg is an Int8Array,
+ the data rate is at ca. 100 Hz,
+ and when much posting happens, e.g. every message,
+ and about every 100th time
````
// TEST CODE to reproduce the error
// (comes from sending arduinoSMS data via Xosc board)
(
q = q ?? ();
q.col = \green;
// happens both with direct NetAddr and broadcasting :
// NetAddr.broadcastFlag_(true);
// q.sender = NetAddr("255.255.255.255", 57120);
q.sender = NetAddr.localAddr;
OSCdef(q.col , {|msg|
// only post once every 2.5 secs - error happens very rarely
// if (msg[1][0] == 0) { msg.postln; };
// post every message, error is about 1/sec!
msg.postln;
}, q.col);
// send test messages:
Tdef(\oscTest, {
inf.do{|i|
q.sender.sendMsg(q.col,
// error happens with Int8Array:
Int8Array.rand(4, 32, 96).put(0, i.asInteger),
// while standard list of args works fine:
// i, 0, 0
);
0.01.wait; //100Hz sending rate
};
});
Tdef(\oscTest).play;
)
Tdef(\oscTest).stop;
Tdef(\oscTest).play;
Tdef(\oscTest).gui;
````
This addition helps to catch the error in the primitive that calls ````recvOSCmessage````
````
/* Usually, the debug line inserted in recvOSCmessage:
// [time, replyAddr, recvPort, msg].postln;
// posts the correct arguments, with test code:
[ 782.696896803, a NetAddr(127.0.0.1, 57120), 57120, [ /green, Int8Array[ -39, 53, 33, 53 ] ] ]
// while, when the error occurs, the args are :
[ 782.70763823, Int8Array[ -38, 35, 44, 86 ], 57120, [ 782.70763823, Int8Array[ -38, 35, 44, 86 ], 57120, [ 782.70763823, Int8Array[ -38, 35, 44, 86 ], 57120, ...etc...
which is listOfAllArgs.putLast(listOfAllArgs).
*/
+ Main {
recvOSCmessage { arg time, replyAddr, recvPort, msg;
// [time, replyAddr, recvPort, msg].postln;
// msg.postln;
if (msg.isKindOf(Array).not) {
"OSC glitch in % : msg is: \n\t%".format(
thisMethod, msg.asCompileString).inform;
"jumping out before recvOSCfunc etc.".postln;
// "msg.dump: ".postln; msg.dump;
^this
};
// this method is called when an OSC message is received.
recvOSCfunc.value(time, replyAddr, msg);
prRecvOSCFunc.value(msg, time, replyAddr, recvPort); // same order as OSCFunc
OSCresponder.respond(time, replyAddr, msg);
}
}
````
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/