Cabbage Logo
Back to Cabbage Site

Dynamic plant creation

Hi,
I have a GUI with a lot of widgets, they are arranged in plants. Each plant has the same set of controls, each controlling an instance of a “module”. All modules do the same thing (just different “channels” or “tracks”). I’d like to be able to dynamically create new modules, for example when the user clicks an “add” or “+” button. I know how to make widgets visible or to hide them. Rather than creating a lot of widgets and hiding them, would it be possible to create them dynamically? (controlled form Csound instrument code at k-rate)?
One thing I would need to do, (also if I use visible(0) to hide unused widgets) is to resize the main window. I can not see that the form widget can use identchannel. Would it be possible for it to do so? So I could resize the window from instrument code?

I’ve often thought about being able to generate widgets in runtime using Csound, but the problem is that neither VST2.4 or VST3 allow for dynamic generation of parameters. The amount of parameters must be known when the plugin is launched. Of course this is only if you wish to access these parameters via the host, or through host automation. If you only wish to interface with the plugin through it’s plugin windows then it may work Ok. But it will create a divide between instruments that work natively and those that don’t. This will in turn lead to confusion I think.

For example, a user opens up one of Iain’s instruments and adds automation curves to various parameters they see in the plugin window. All good. Everything behaves as it does with all VST plugins. Then they open another instrument, don’t see any parameters, yet see loads of sliders in the plugin GUI. They assume the instrument is broken. Cabbage sucks they say, “You can’t even add automation to parameters! What kind of plugin framework is this?”

Btw, this type of dynamic parameters can’t be supported by any VST plugins. What many do id declare a max number of params on startup, but hide the parameters from the users in the host. But I think it involves some kind of hack. It’s more or less what I had to do with the AU implementation of Cabbage.

Agreed, it needs to work the same in different contexts. So all ok. If I know it is really necessary to do a hack, I can go that route with confidence. :slight_smile: