Invoking a LuaAction from within a Lua script

Hi All. Is there a way to invoke a registered LuaAction from within a Lua script?

1 Like

So it looks like it should be:

Editor:access_action( "LuaAction", "script-1" )

This works (i.e. it runs the script attached to LuaAction/script-1) if I run it from the “Windows/Scripting” dialog, but it seems to do nothing at all when I include it in an otherwise working DSP lua script. The DSP script runs without error but just doesn’t invoke the script attached to LuaAction/script-1. Are there any restrictions on what can and can’t be done in a DSP script that may cause this? FYI - my DSP script is supposed to listen for silence of a specified duration, and activate the script when such a silence occurs.

Yes, as the manual says at the end of Lua Scripting > DSP Scripts:

The dsp_run / dsp_runmap method is invoked many many times per second so needs to be very fast. If any script in there is doing anything too time consuming then the method won’t be able to complete in the very short time window it has. In short: buffers can’t be filled on time → gaps in the audio.

There are quite a few things DSP scripts can’t do, i.e. are prevented from doing. The manual wording comes across as “Session object methods” but it’s not just those, as you have discovered.

Thanks. That makes sense. So is there any approach I could investigate to achieve my goal? For instance, is there any way to activate a command in the UI thread from within the dsp thread? Or could I send out a midi message from the dsp thread that could be mapped to the required UI action? FYI the action I’m trying to invoke just disables all the Graillon auto-tune plugins in the session.

If the trigger for the action is you changing a parameter on this DSP plugin then perhaps a Hook script? I can’t remember if parameter changes are a signal/trigger they can use - and that might be a bad idea anyway - but they do have two periodic signals: can’t remember the names but one will make the hook script run every second and the other every 1/10th second.

This script could check what the parameter values are on your plugin instance, and if the relevant one has changed to the relevant value then do whatever you want. Hmmm, maybe not “whatever”, I seem to recall that Hook scripts too are prevented from doing some things. Also, to know that the value has changed it needs to remember what it was on the previous script run. How to do that?

Thanks for the idea. I’ll look into it.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.