Page 1 of 1

Can someone give a clue?

Posted: Wed Mar 29, 2017 3:55 pm
by lulu m
Hi,

I have this Lua code module, to fill up the first 16 A slots in the slot rack, in my program:

----

defineParameter("loadedPatch", "The Loaded Patch", "init", nil)

function onLoad()
prog=this.program
--Load it into the slots
for t=2, 16 do
this.parent.instance:getSlot(t):setProgram(prog)
end
loadedPatch=prog.name
end

----

All is well when I load the patch the first time, and it's placed into the first slot in the program table and into the 16 A slots in the slot rack!
When I load another program, with the same script, the program is automatically loaded into the next slot of the program table, instead of replacing the already loaded and selected program!!???

When I out-comment the loop for loading the program into the slots, the program does gets replaced in the program table, but of course only 1 slot filled?!

(I tried with this.parent, this.program, ... no change :x )
I hope I'm a bit clear?

Someone, please :?:

Re: Can someone give a clue?

Posted: Sat Apr 01, 2017 6:36 pm
by AposMus
I haven't tested this, but have you tried

function onLoadIntoSlot()

or

function onInit()

This delays the callback even more. At the moment your script is triggered when the script module is loaded, which is before the program is loaded.

Like I said, I have no idea if this is the answer, but it seems like an option.

Re: Can someone give a clue?

Posted: Mon Apr 03, 2017 9:05 am
by lulu m
AposMus wrote:I haven't tested this, but have you tried

function onLoadIntoSlot()

or

function onInit()

This delays the callback even more. At the moment your script is triggered when the script module is loaded, which is before the program is loaded.

Like I said, I have no idea if this is the answer, but it seems like an option.
Thanks AposMus for the tip,

Yes I tried the onLoadIntoSlot and the result is the same unfortunately :-(
The onInit doesn't work and gives an error message 'No matching overload found, candidates: init setProgram(....). I guess, onInit needs a program that is already set into a slot.

I hope someone at Steinberg could give me a clue, so I can continue to move on? Please steiny I'm out of ideas ;-)