# Solution for user-made presets?

**URL:** <https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262>\
**Category:** Cabbage Stew\
**Created:** [8 January 2021 16:13 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262 "2021-01-08T16:13:42Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![giovannibedetti](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/giovannibedetti/32/4146_2.png) [@giovannibedetti](https://forum.cabbageaudio.com/u/giovannibedetti)\
**Post date:** [16 February 2021 17:01 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/41 "2021-02-16T17:01:20Z")

</div>

Could you add an invisible item and set it as the selected one as soon as you start editing values?  
So you could click on the item you are modifying to go back to its original state. (Forgive me if this suggestion is b\*\*\*\*\*\*\*t)

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [16 February 2021 17:07 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/42 "2021-02-16T17:07:05Z")

</div>

That might work but would be quite a hack. The preset system is frail enough as it is 🤣

Having to select another preset and then back again isn’t the world worst solution, albeit a little cumbersome. Leave it with me. I’m just I’m not the only JUCE developers that has encountered this problem. I’ll have a look over the forums.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [17 February 2021 17:14 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/43 "2021-02-17T17:14:35Z")

</div>

I had another look at this, and a some time spent browsing posts to the JUCE list got me the solution. I’ll push it and trigger a new build when I get a chance. I just want to tidy up some other things first. 👍

---

<div class="post-metadata">

**Author:** ![RZorn](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rzorn/32/2611_2.png) [@RZorn](https://forum.cabbageaudio.com/u/RZorn)\
**Post date:** [17 February 2021 19:31 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/44 "2021-02-17T19:31:30Z")

</div>

Don’t hurry. I did not know that there is something like JUCE behind the scenes. And as I said, it is more a ‘nice to have’.

---

<div class="post-metadata">

**Author:** ![Retornz](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/retornz/32/2714_2.png) [@Retornz](https://forum.cabbageaudio.com/u/Retornz)\
**Post date:** [18 February 2021 12:11 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/45 "2021-02-18T12:11:05Z")

</div>

In ToneZ I made a “Reload” button, when you click on it it will Reload the preset to the state saved in the file  
I don’t remember if it is in the preset manager I provided but it is definitely in ToneZ

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [18 February 2021 12:20 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/46 "2021-02-18T12:20:11Z")

</div>

The latest beta that is currently cooking allows users to reselect an item, at which point it will return the state back to how it was before editing. It will be available [here](https://dev.azure.com/rorywalsh/cabbage/_build/results?buildId=1129&view=results) once it’s done. Let me know how it goes. 👍

---

<div class="post-metadata">

**Author:** ![RZorn](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rzorn/32/2611_2.png) [@RZorn](https://forum.cabbageaudio.com/u/RZorn)\
**Post date:** [21 February 2021 08:40 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/47 "2021-02-21T08:40:16Z")

</div>

I fear there is still a bug in the save mechanism if one overwrites a preset:

[https://drive.google.com/file/d/1AjcKPW6Wi\_Bgsp8o4RLRaP\_lHOPHDJm1/view?usp=sharing](https://drive.google.com/file/d/1AjcKPW6Wi_Bgsp8o4RLRaP_lHOPHDJm1/view?usp=sharing)

I loaded the preset “e-piano” then I changed the sustain (just to create a difference) and saved it under the same name. Then the combobox jumps to the last preset, “organ”. Selecting “e-piano” again shows that it did the save/overwrite correctly just did not stay with that preset.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [21 February 2021 09:18 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/48 "2021-02-21T09:18:10Z")

</div>

Thanks. I was sure there might be some teething issues with this!

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [24 February 2021 09:25 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/49 "2021-02-24T09:25:57Z")

</div>

I think I know what is going on here. In the previous system jumping to the last preset made sense as the last preset was always the most recent one. Thanks, I’ll take a look today and hopefully find a fix.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [24 February 2021 09:57 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/50 "2021-02-24T09:57:10Z")

</div>

That’s fixed now. You can grab the latest build when it’s done. Let me know 😉

---

<div class="post-metadata">

**Author:** ![RZorn](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rzorn/32/2611_2.png) [@RZorn](https://forum.cabbageaudio.com/u/RZorn)\
**Post date:** [24 February 2021 11:25 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/51 "2021-02-24T11:25:47Z")

</div>

I will try it out. Does the build also include the stack dump mentioned in the other post [Hello Cabbage falls very often. Any suggestion?](https://forum-next.cabbageaudio.com/t/hello-cabbage-falls-very-often-any-suggestion/2221/20) ?

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [24 February 2021 11:33 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/52 "2021-02-24T11:33:03Z")

</div>

No, I posted that to the other thread. Note that the stack dump version doesn’t have the fix for the presets. Actually, the latest dev build does have a stack dump on exit, but as it’s a release build I’m not sure how much info it will produce for us.

---

<div class="post-metadata">

**Author:** ![hdale94](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/hdale94/32/6371_2.png) [@hdale94](https://forum.cabbageaudio.com/u/hdale94)\
**Post date:** [9 March 2021 16:36 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/53 "2021-03-09T16:36:58Z")

</div>

Okey, so I’m trying to collect the save and remove button into one combobox, but when doing a chnget on the preset buttons I get this error:

> PERF ERROR in instr 8 (opcode chnget.k) line 599: chnget.k: not initialised  
> from file C:\Program Files (x86)\VstPlugins\Graindrop Beta\Graindrop Beta v1.4.csd (1)  
> kRemove chnget.k “RemoveButton”   
> note aborted

Any way around this?

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [9 March 2021 16:45 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/54 "2021-03-09T16:45:52Z")

</div>

Can you send me a simplified .csd illustrating the the problem?

---

<div class="post-metadata">

**Author:** ![hdale94](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/hdale94/32/6371_2.png) [@hdale94](https://forum.cabbageaudio.com/u/hdale94)\
**Post date:** [9 March 2021 16:56 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/55 "2021-03-09T16:56:07Z")

</div>

Something like this  
[PresetsNamedButtons.csd](https://forum.cabbageaudio.com/uploads/short-url/i80bm2G7gku0BRWNrXYxkAUmY1V.csd) (1.2 KB)

---

<div class="post-metadata">

**Author:** ![hdale94](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/hdale94/32/6371_2.png) [@hdale94](https://forum.cabbageaudio.com/u/hdale94)\
**Post date:** [9 March 2021 17:00 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/56 "2021-03-09T17:00:04Z")

</div>

```
kMenuTrigger chnget "Combobox"   
kSave chnget "SaveButton"
kRemove chnget "RemoveButton"

     if changed:k(kMenuTrigger) == 1 then  
            if (kMenuTrigger == 1) then
                kSave = 1
            if (kMenuTrigger == 2) then
                kRemove = 1
else
kSave = 0
kRemove = 0

```

Something like this with the combobox

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [9 March 2021 17:00 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/57 "2021-03-09T17:00:11Z")

</div>

filebuttons send info on string channels, not k-channels. Try

`SRemove chnget ...`

Although I’m not sure that helps you? I have to run, but I’ll check back in later…

---

<div class="post-metadata">

**Author:** ![hdale94](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/hdale94/32/6371_2.png) [@hdale94](https://forum.cabbageaudio.com/u/hdale94)\
**Post date:** [9 March 2021 17:00 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/58 "2021-03-09T17:00:30Z")

</div>

Will test 👍  
Edit: Ah right, it’s a filebutton and not a normal button, noticed now  
Edit 2: Hmm, can’t make it trigger…

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [9 March 2021 19:05 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/59 "2021-03-09T19:05:18Z")

</div>

Sorry, I didn’t quite have time to look at what you are trying to do. When you use a `filebutton` in preset mode it doesn’t send any channel data. But there is no good reason for it not to. It just never came up before. Let me take a look…

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [9 March 2021 19:45 UTC](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262/60 "2021-03-09T19:45:01Z")

</div>

Ok, new build is just underway. You should now be able to grab the name of the newly created and deleted presets from their respective channels.

```
instr 1

kValue init 0
SSave chnget "SaveButton"
if changed:k(SSave) == 1 then
    kValue randi 200, 200
    printk2 kValue
endif 

endin
```

[Previous page](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262.md?page=2)

[Next page](https://forum.cabbageaudio.com/t/solution-for-user-made-presets/2262.md?page=4)
