Available for all global callbacks, or those at a widget/control level?
The only way I’ve found to communicate between the global script and widgets/controls is using the notify function. Everything I’ve tried to reference a custom global function in the widget/control script ends up with: No such property or function.
Some examples based on what I’ve figured out…
This is a button script (named ‘button2’):
if key == 'touch' and self.values[key] == true then
self.notify(self.parent, self.name, "Hello World")
This is in the global script:
function onReceiveNotify(source, string)
print(string.." from "..source)
Oh yeah, I had tried that first. I put a trivial function there and tried to call it from a control and got some message about a nil something or other.
After looking at their document, it seems that every control has its own Lua context which is probably why this doesn’t work. Sounds like a bad approach…they should at least have provided some shared area somewhere. I wonder if there is an “include” mechanism that could be used, but even if there is, it seems like there might be a problem controlling all the local controls.
For example, if you have ten faders, how would you write a function that would set them all to zero?
function onReceiveOSC(message, connections)
RadioButton('faders', 3, 1.0)
function RadioButton(group, index, value)
for i = 1, #self.children[group].children do
if i == index then
self.children[group].children[i].values.x = value
self.children[group].children[i].values.x = 0.0
I have a question more or less related to this topic. I’m trying to create a TouchOSC template to provide personal monitoring control focused on TotalMix Fx, which is the mixer of my RME audio interface. In TM FX a channel can have a different function depending on the current bus mode. You can change the bus mode by sending one of the following OSC messages: “/1/busInput/ 1.0 “, “/1/busPlayback/ 1.0 “ or “/1/busOutput/ 1.0 “. In a personnal mixer you potential have to control a mic level (busInput), a keyboard mix (busPlayback) and a global level (busOutput). When moving a fader, it is easy, you simply have to set the bus you need before sending the fader volume message. But if you want to receive any incoming message you have to filter out those not related to your fader (meter, label, or whatever) by knowing the current bus.
You can know the current bus by receiving one of the OSC bus message and my idea is to store this information in a global variable, such that when receiving an OSC value, I could perhaps use the touchOSC control (widget) script to check if the control/widget value has to be modified because the bus mode related to this particular control/widget is selected.
e.g. if my volume1 control/fader receives the OSC message /1/volume1 x, I only want it to be modified if the current bus mode is /1/busInput.
Where is the better place to store this global value?
Is the Lua context of the touchOSC global script shared with the local control script? Could it be possible to store this information in each control script, will the scope of a value persist after the local control script has been run?
Should I use a hidden control to receive the bus message? There is then probably a way to check this control value from another local control script…
As I am starting with touchOSC, any help will be appreciated…
I finally went to another solution. As I am a TouchOSC newbie, I don’t know if it is the best solution and my definitive one. For each control, I use a script which catches the bus information and accordingly enable/disable the OSC message which receives the value changes. Now, I will try to find a solution to cycle the bus mode in order to receive meter information for each fader, given that they are all in different bus mode. I don’t know if it is doable, but I will try to do it.