Add Notifier: When Document Is Loaded - From Globaloscactions.lua


I’ve used the app_new_document_observable:add_notifier before from a tool. However now I need to add an notifier that sends OSC, so I’m sitting in GlobalOscActions.lua. The following obviously doesn’t work, since renoise.tool() is nil.

 print("document loaded...")  

How do I add a notifier for when the document is fully loaded in GlobalOscActions.lua?

GlobalOscActions.lua have no such notifiers. So you should consider adding this kind of custom OSC functionality into a tool anyway. There is no real “standard” on how to do loop backs with OSC. The raw OSC format is unidirectional, but can be used for bidirectional connections too.

See for snippets on how to send and receive OSC in a tool, in case you have not seen this already.

Hi Taktik!

Thanks for the reply!

I just did (before reading your post) and it works great. Could I move all my add_global_action defs (including reception of OSC) that I currently did in GlobalOscActions.lua to the tool too? If so anything to be aware of?

The greatest advantage of doing it as a tool is the clean-ness of the packaging, much better than having to append stuff to GlobalOscActions.lua…

Thanks again for your reply!

If you copy the “add_global_action” registration mechanism too, or add one that works the same way, this should just work.

require “GlobalOSCActions” could work as well?

Thanks guys!

I ended up else-if’ing through the few types of messages I’d like to handle. I appreciate the API-like effort presented in Globaloscactions.lua, but with my own code I prefer a more direct approach.

Everything is really running smoothly here now, I load a project in my external application and it automatically load a xrns over OSC, renoise send osc back when load is done, all instrument and track names are requested and transferred back to my app over OSC and my app triggers notes in renoise over OSC. Everything on the renoise side is wrapped up in a tool and it’s rock steady.