rorywalsh / cabbage

Framework for developing audio plugins with the Csound programming language.
http://cabbageaudio.com
GNU General Public License v3.0
509 stars 35 forks source link

cabbageCreate does nothing in instrument 0 #153

Open eleses opened 3 months ago

eleses commented 3 months ago

Admittedly, the on-line manual only shows cabbageCreate being used in an instr > 0. But since cabbageCreate only works at i-time and is needed when app/plugin starts, it seem superfluous to drop those calls inside a numbered instr instead of the top-level orchestra code (aka instrument 0). However cabbageCreate does nothing if called from the (top-level) instrument zero orchestra code. This is slightly confusing.

By the way, when cabbageCreate is called from a numbered instrument, that instrument can be turned off (with turnoff) right away after cabbageCreate without affecting the generated widgets. So, being in a running instrument doesn't seem essential for cabbageCreate.

(I'd have guessed that maybe cabbageCreate and friends are injected by Cabbage as UDOs at the end of instrument 0, but in that case they'd give an explicit error when used before definition in instrument 0.)

rorywalsh commented 3 months ago

It's a while since I added those opcodes, but iirc this has to do with the plugin parameters being registered properly with the host. I'd have to look through the source to find the actual answer, but I agree that it is a little clunky, especially considering a single init pass will do the job. This is an area I'll revisit in Cabbage 3, which I'm up to my eyes in developing right now :)