Ok, I've looked into this, and I think my fix may break some existing instruments...
The old version of Cabbage would wait until the orchestra had started running before sending the filebutton string to its channel. Consider the following code from @iainmccurdy:
gSfilepath chnget "filename"
kNewFileTrg changed gSfilepath ; if a new file is loaded generate a trigger
if kNewFileTrg==1 then ; if a new file has been loaded...
event "i",99,0,0 ; call instrument to update sample storage function table
event "i", 99, 0, 0 would be triggered after the first perf-pass as Cabbage would wait until the first perf-pass before updating the channel. I think this is a poor implementation. I think that the channel should be initialised before the instrument runs, as is the case with all other widgets, sliders, buttons, etc. Now, the reason why my example worked was because of init-pass fall through on k-rate conditionals. Consider the following
SFile chnget "filebutton"
kChanged changed SFile
if kChanged == 1 then
SMessage sprintfk "file(\"%s\")", SFile
chnset SMessage, "soundfilerIdent"
On the first init-pass,
chnset SMessage, "soundfilerIdent" will be hit because of fall through. Iain's use of the
event opcode, which only runs a k-rate, avoids any such fall through.
In all of Iain's instruments that I've checked, a simple score statement calling his file loading instruments can resolve the issue and the sound files will be updated as one would expect. I'd like to hear back from Iain on this as it directly affects his instruments! If users prefer the old way or can think of advantages it has over the new system please let me know.