I’m trying to detect in my LUA script when sample recording is done and if it was successful (i.e. new instrument with sample created).
Since there is no direct access (yet) to the sample recording dialog I was trying to use a notifier coupled to:
The problem is that when the sample recorder creates a new instrument to store its successful recording, the selected_instrument changes and triggers my callback function before the sample recorder is fully done.
After some testing I found out that at the moment the selected_instrument callback function is called:
no sample data exists yet
the instrument is yet to be named by the sample recorder (“Recorded Sample xx”)
Since I’m making changes to some sample properties in my script, this poses a problem.
When executing the same callback function by calling it from a menu manually (many cycles after the sample recorder is fully done), everything works as I hoped for.
The other problem I’m having is to detect an unsuccessful recording. The conditions for that one are:
no successful recording detected
sample recorder is closed
Assuming my first problem is solved with an appropriate notifier, it also provides me with condition 1 for this second problem. For the second condition there is still a problem. Since there is no wait function in LUA (the only OS independent option is busy waiting), I can’t be polling the renoise.app().window.sample_record_dialog_is_visible. So also for this I need to use a notifier. Don’t know which one to use.
I’ve been at this for quite some hours and would really appreciate it if somebody can point me to the best observables to use (if any).
Problem (as I understand it at the mo): Selected instrument callback is fired but BEFORE the instrument name and sample data appears in Renoise so you can’t get access to those variables (I take it they are nil or whatever) in the callback. Now I’m assuming you’ve looked at every other observable etc… If I was in that situation I’d be thinking timers (or use the idle notifier function) and flags. i.e set a timer function notifier callback up (say called every 100-200ms). Just set a flag in the selected instrument callback that says that a new instrument has been created. In the timer (or idle notifier) callback function you then keep querying if the data has appeared yet:
I.e. (some funny strange code)
local new_selected_instrument_flag = false
function timercallback() -- <= this will be called every say 100ms (or whatever you set it to) (or use the idle notifier)
if (new_selected_instrument_flag == true) then
if (data_in_sample ~= nil and name_instrument ~= nil) then
new_selected_instrument_flag = false --clear the check flag
-- Must have some sample data and name in our new sample here
-- Do whatever...
new_selected_instrument_flag = true --Right set the flag, we know a new instrument is created at this point
That’s very very rough. Now I’m not saying it works (this is off the top of my head) but I’m trying to give you a quick idea on what road I’d be going down to try and monitor when buffers appear in Renoise
Develop it further? Errrmmmmmmmm…trying to decide on that to be honest. Of course we are not talking just a basic script here. It would be quite a challenge (to say the least) to get it to just something sort of practical. My implementation would be as simple as possible. It would have a lot of limitations. I’ll probably keep messing around with it…well you never know!
Haha, I appreciate the honesty. If you ever decide to do something with it in the future, I would be happy to help (both in terms of implementation and/or concept design).
Anyhow… keep up the good work
I would be happy to help (both in terms of implementation and/or concept design).
Sorry for the late reply. Thank you for offering sir
It is worth saying that this is a very experimental tool (it will only work on Linux 64-bit OS anyway.) It isn’t ment to be taken seriously or anything. I wanted to get an idea on how fast Lua script in Renoise would send/receive messages to an external program via UDP sockets (that’s how it got started.)