Cabbage Logo
Back to Cabbage Site

Solution for user-made presets?

Hi, does anyone have a solution for naming and saving user-made presets? I’m currently using the one from the Presets.csd in the examples, and I’m looking to expand it further.

@Retornz, formerly @TONITRMX, published a custom preset manager to this list some time ago. Search for it, I think it should be easy enough to find.

1 Like

I’m going to take a look at this too, since I might want similar functionality in my projects. So I may as well jump in.

@rorywalsh did you mean this one? - Easier way to share presets

1 Like

That’s the one :+1: It works very well in his plugin.

So, I tried to use a combobox to select the preset, which works nicely. But when you save a new preset, there’s a bug when trying to select another preset, as the combobox text returns back to the newly saved preset no matter which one you choose.Preset Manager Works.rar (2.3 KB)

I’m not sure what’s going on here as I have never used this. @t_grey, did you have a chance to look into this?

I can confirm this behaviour. Any time after I save a new preset the combobox jumps back to the saved preset an instant after I select another one. (Actually, the preset selected by me is visible for a fraction of a second.) I cannot figure out any mistake in the code from @hdale94 so I think it is some problem with the implementation of combobox.

But I found another (smaller) problem. The Save button opens the file dialog in the current directory, not in subdirectory presets - although the filebutton statement contains a populate(".pres",“presets”). The first argument is honoured but the second not. The problem arising from this is that without selecting the subdirectory ‘presets’ the presets are written to the current directory and subsequently don not appear in the combobox.

Interestingly, also in that case the first thing happens. If I save a file to the current directory the combobox jumps back to the last preset I saved in ‘presets’ and gets locked on that.

Finally, a question to the developers: I am looking into this topic only because I would prefer user-named presets to the default counting mechanism described for the snapshots. Would it be possible to implement user-named snapshots? (The fact that these always store all parameters would not bother me too much.)

I think much of this post relates to the Preset manager? I can’t really comment on that as I never used it myself, nor did I write it.

One the other hand I will look onto the populate issue with filebuttons. Quite a few people have asked for a way to change the preset name. I’ll also take a look at see if it is something I can add :wink:

I’ve added a new ‘named snapshot’ mode for filebutton widgets.

You should be able to access it in the latest dev build available here when it finishes building.

[edit] I also fixed the filebutton issue you mentioned.

1 Like

Nice!! I have been a little absent lately because of a intensive course at the university. Looking forward to implementing this :grin:

1 Like

Hey @hdale94, I will take a look at your code when I can !
In ToneZ I don’t have any issue like this with Comboboxes, so hopefully we will find the curlpit :wink:

2 Likes

Works very nice Rory, and the “Set Preset Name” popup looks smooth :smiley:

So, I took a look into it :

  • With the code I provided using a Listbox : it works,
  • With the modification to use a combobox instead of a listbox it doesn’t work anymore… I can exactly see the bug you get.

My guess is that it has nothing to do with the actual “preset management system” but it is more an issue within the combobox widget : especially when the combobox detect a change in the folder (= new file created by Cabbage)

That could explain why there is no issue with listboxes : there is no automatic refresh, for the listbox I asked for a way to refresh them from Csound and @rorywalsh developed the chnset "refreshfiles()", "channel_of_the_listbox" to refresh the listbox from Csound on request.

I tried to look at the code to see if I could spot any major difference between the 2 widgets that are actually pretty similar but I counldn’t find any… I think Rory will spot the issue in seconds :wink:

To help you, I made a much smaller code to test the issue presetManager_CBBOX_BUG.zip (943 Bytes)
(Just run the code, and save a file (random name allowed) it will just create a NEWFILE.pres into the preset folder and will help to see when the bug is here / when it’s gone

Hope it will help !

Thanks @Retornz, I took a look at your simple example, and I can see the issue. My first attempt at a fix does indeed fix the problem, but causes issues with standard string comboboxes :rage:

I’ll take another look when I get a chance, but it might be Monday before I get something. I’m not sure if it’s any good to you, but I wrote a channel save and channel recall opcode read and write to JSON. It means you don’t have to keep track of all the parameters you want to save.

1 Like

As I was walking away from my machine the answer came to me :rofl: Comboboxes that scan directories automatically add a ‘Please Select…’ as the first item, although it doesn’t do anything. String comboboxes don’t, which explains why the indexing got all messed up. I guess the question is, do we need the ‘Please Select…’ item or can we drop it?

1 Like

I think I’ve fixed this now. Please test in the latest beta builds. Be careful, when setting the value of a string combobox, you need to pass the string, not the index:

combobox bounds(170, 126, 180, 15) populate("*.pres", "presets") channel("box") channeltype("string") identchannel("boxI") value("1-some.pres")
combobox bounds(170, 186, 180, 15) items("this", "that", "the other") channeltype("string") value("that")
1 Like

To me, for Listbox / Combobox the “please select…” is not necessary (in my Cabbage build for ToneZ I got rid of it).
I can understand when people would like to have this indication, so maybe the best would be to enable it by default but have something like : selectindicator(false) that could be set to Combobox & Listbox to remove this “Please select…” ?

I actually got rid of it. Removing it makes things a little more consistent across widgets, and I don’t think it will break backward compatibility. So I think your preset manager should now work again :wink: I’ve been recommending it to users quite a bit!

Thanks for all the work and how quickly you did this. I am eager to try it out but I fear I have a much bigger problem now. Cabbage won’t start at all… (I posted this in another thread where it is more related: Entry Point Not Found)

So when I try the new “presetManager_CBBOX_BUG.zip” file after downloading the newest version of Cabbage, it seems to work. However, after saving the preset, the combobox starts blinking for some reason

ComboboxBlink