Cabbage Logo
Back to Cabbage Site

Selecting/loading preset on start

I’ve been trying in vain to select a preset on initialising my plugin, when using populate("*.snaps"). value(x) doesn’t seem to work, but it works on a normal combobox. Similarly using something like chnset "value(2)", "presetsIdent" doesn’t have any effect.

Basically I’d like my plugin to initialise into a state without having to select a preset manually :wink:

cheers

I thought there was way to do this. I’ll need to try it out myself. Leave it with me a bit…

I have this working but when loaded a saved file in a host it doesn’t display the correct preset, although it does load it. Saved sessions override default widget values, so it should really display the correct preset too. Leave it with me another while…

The more time I spend on the preset system as it is, the more potential problems I see with it. Both the host and the plugin use the same preset/state saving mechanism. And when it comes to both a host and a plugin selecting presets things get a little confusing. I think I may have to revisit this entirely…

Right now I’m leaning toward writing a few custom opcodes that will save and recall the state of all channels in an orchestra. This would decouple the loading and saving of presets in Cabbage from the host, which should make things far more flexible. If it works out I will deprecate the current system. Rest assured the current system will still work just as it always has, but users will be encouraged to use the newer system. Especially when they hit an issue with the current system, which you just did!

eek @rorywalsh sounds gangly, but equally a chore worth doing!

Ok, this should be working now. If you want to set the initial value you must use a string rather than an index, as these presets are string channel widgets. For example:

combobox bounds(74, 190, 100, 25), populate("*.snaps"), channeltype("string"), value("Presets 2")

Note too that in the (recent) that if a combo with a populate() was created, Cabbage would automatically set the channel type to a string. I’ve reverted this because I forgot that you can also use a populate() combobox with numeric indices rather than strings. Anyhow, let me know if this works.

Next up is to add state recall to the patcher.

Hi, I can confirm that the combobox is indeed now initialising, but the widgets aren’t actually initialising. I though it might be related to the custom plant, but the tempo rslider (not part of the plant) isn’t updating either.

Ok, I’ll take a look.

I think it finally working now. Check out the latest build when you get a chance.

Can confirm this is working a treat. Thanks again :slight_smile:

Hi,
Have the same problem on Linux, but I don’t any commit refering to this, do I miss something ?

Build the dev branch. These changes were made there. :+1:

1 Like