Make ardour6-lua (lua session) keep alive after session load

Hello all,

I have a very simple Lua script that simply connects to Jack and loads the session/snapshot I want. It looks like this:

#!/usr/bin/env ardour6-lua

backend = AudioEngine:set_backend("JACK","","")

s = load_session ("/Users/jcrystal/ardour/Test-2020-06-16-10-19-24","snapshot1")

When I run it (via bash), it does everything I’d expect (including beginning to monitor audio), and then immediately quits. Is there a way to cause a luasession to keep alive after a session load?

An infinite while loop just drains my CPU.

Thanks!

-Jason

You could add -i, from ardour6-lua --help

-i, --interactive   enter interactive mode after executing 'script',
                    force the interpreter to run interactively

but that will also fail if you start it without a terminal.

Another option is in the script itself:

 ARDOUR.LuaAPI.usleep (-1) -- sleep indefinitely

(or any positive number, in microseconds)

Great suggestions; thank you!

was exactly what I was looking for. Didn’t know about the -1 option!

On second thought I may have confused this with sleep (0), and usleep (-1) may only wait for 2^32 μs ~71 minutes.

Then again, you could wrap this in a while true loop.