oscout() is sending corrupted messages
Posted: 07 Nov 2012 00:29
My goal is to send the text of a Menu object's currently selected item. So, I've created a script object that is a child of my Menu object, with the trigger being On Expression and the expression being "selection". I would like the following script to work:
On my target, a Windows 7 app, I can see (with a debugger) that the OSC Bundle has problems. The last two characters of the string are missing and there's a malformed 2nd OSC Message with an invalid OSC address. So, some of the data is getting through, but there's corruption.
I tried putting the data parameter in braces. This doesn't work either.
I know the problem is likely with oscout because I can use the text from getattribute to display on a Text object. Also, if I use string literals in the oscout call, then it works fine.
So, my last resort is to do crazy stuff like this, which works:
But I might have dozens of items in the menu, with some long strings, too. I don't want to use so much error-prone script to accomplish this goal when it should take just one line of script.
Am I doing something wrong? Even if I am, I don't think oscout() should ever send corrupted data. Thanks in advance for any help anyone can provide.
Code: Select all
oscout(0, '/SoundMixResource/Faders/0/Group', getattribute(getobject(),'items')[selection]);
I tried putting the data parameter in braces. This doesn't work either.
Code: Select all
oscout(0, '/SoundMixResource/Faders/0/Group', {getattribute(getobject(),'items')[selection]});
So, my last resort is to do crazy stuff like this, which works:
Code: Select all
decl menuItemText = getattribute(getobject(),'items')[selection];
decl oscDataText;
if (menuItemText == 'A')
oscDataText = 'A';
else if (menuItemText == 'B')
oscDataText = 'B';
else if (menuItemText == 'C')
oscDataText = 'C';
oscout(0, '/SoundMixResource/Faders/0/Group',oscDataText);
Am I doing something wrong? Even if I am, I don't think oscout() should ever send corrupted data. Thanks in advance for any help anyone can provide.