OSC messages are sent twice
Posted: 30 Jun 2015 13:44
Dear Liine Forum,
I have a short, and hopefully easy question. I'm not that familiar with Lemur and I'm looking into this for quite some time now, so I hope one of you can give me a solution.
It's actually very simple.
I'd like to have an array of buttons, radio-style meaning when I tap on one of the buttons, it will get highlighted, the previously highlighted button is set back. I also want to send different OSC messages for each button, that is because the Lemur surface will be used to controll Reaper, and as far as I know, Reaper cannot handle incoming float arrays that come with an OSC message (since this is what Lemur sends, e.g., we have 5 buttons, I tap on button 1, then it sends something like /myOSCmessage f[1.0 0.0 0.0 0.0 0.0]).
So, I came up with a litte workaround. I'm using the switch widget with 5 elements, behaviour is set to "radio". I have written a short script that takes care of the OSC message handling (and therefore I set the global OSC target for this widget to "None"). The script is added to the Switch widget.
Executed "on Expression x"
If I'm not wrong, x is an array of size(numberOfButtons). Similar to the example above, let's assume 2 buttons, i.e. x=[1.0, 0.0] for button 1, and x=[0.0, 1.0] for button 2
Then the script looks like this:
if(Switches.x[0] == 1.0){
oscout(0,'/selectSong01',1.0);
return;}
if(Switches.x[1] == 1.0){
oscout(0,'/selectSong02',1.0);
return;}
That works fine, it triggers the correct messages, but the OSC messages are sent twice, which I'd like to avoid (and which I actually don't understand why that happens). I tried the different trigger options for the OSC message (send if value changes from 0 to 1, from 1 to 0, etc.) but it seems that has no impact. It is always sent twice (like with press/release button). Then again, if I add e.g. "SelectSong.x[1] = 0.0;" in the if clause after the oscout, then I have in fact a pad function, and the message is sent only once.
Any ideas/insights/articles? Find the project file below.
Thanks a lot!
Dirk
PS: I hope this is not a duplicate thread, for some reason, the forum search does not work, when I type in "OSC" for example, it returns zero results ...
I have a short, and hopefully easy question. I'm not that familiar with Lemur and I'm looking into this for quite some time now, so I hope one of you can give me a solution.
It's actually very simple.
I'd like to have an array of buttons, radio-style meaning when I tap on one of the buttons, it will get highlighted, the previously highlighted button is set back. I also want to send different OSC messages for each button, that is because the Lemur surface will be used to controll Reaper, and as far as I know, Reaper cannot handle incoming float arrays that come with an OSC message (since this is what Lemur sends, e.g., we have 5 buttons, I tap on button 1, then it sends something like /myOSCmessage f[1.0 0.0 0.0 0.0 0.0]).
So, I came up with a litte workaround. I'm using the switch widget with 5 elements, behaviour is set to "radio". I have written a short script that takes care of the OSC message handling (and therefore I set the global OSC target for this widget to "None"). The script is added to the Switch widget.
Executed "on Expression x"
If I'm not wrong, x is an array of size(numberOfButtons). Similar to the example above, let's assume 2 buttons, i.e. x=[1.0, 0.0] for button 1, and x=[0.0, 1.0] for button 2
Then the script looks like this:
if(Switches.x[0] == 1.0){
oscout(0,'/selectSong01',1.0);
return;}
if(Switches.x[1] == 1.0){
oscout(0,'/selectSong02',1.0);
return;}
That works fine, it triggers the correct messages, but the OSC messages are sent twice, which I'd like to avoid (and which I actually don't understand why that happens). I tried the different trigger options for the OSC message (send if value changes from 0 to 1, from 1 to 0, etc.) but it seems that has no impact. It is always sent twice (like with press/release button). Then again, if I add e.g. "SelectSong.x[1] = 0.0;" in the if clause after the oscout, then I have in fact a pad function, and the message is sent only once.
Any ideas/insights/articles? Find the project file below.
Thanks a lot!
Dirk
PS: I hope this is not a duplicate thread, for some reason, the forum search does not work, when I type in "OSC" for example, it returns zero results ...