General

Call global static variable or function

Started by Bonobo on .

Sign in or create an account to join the conversation.

2 posts

Topic starter
Hey folks !

I´ve set a number of global variables for ctlout and midiout in which I store the on/off state of devices.
decl fx_delay_off = ctlout(0,83,0,16);
decl fx_delay_on = ctlout(0,83,127,16);
This is to have a single place where I can define the midi-channel of a device and to change it for all pad scripts in 1 place if the midi channel for the device changes.

I would now like to call this variable on a pad for the "on expression(x)" akak button press.
I cannot find any reference in the documentation there.

I could of course simply store the values for the channels in form of decl ch_delay = 16
and on pad press call ctlout(0,83,ch_delay)
but storing the entire CTL-expression is far more elegant.

Is there a way to call global variables on pad press and have the result execute
or turn the ctl expression into a function that can be called on button press ?

Something like:
Pad -> on expression (x)
fx_delay_off()

Thanks for your thoughts !
Joe