Cabbage Logo
Back to Cabbage Site

Preset system : questions

Hello,
Once you have a lot of preset files, it is difficult to remember which file corresponds to which specific properties of the cabbage instrument. Can the texteditor be used for saving a short comment about each preset properties?

As far as I understand, the preset system saves ONLY the state of widgets.
How could I stave the status of variables ?
The idea behind is to use less widgets. I working on a new synth using GEN 19 routine.
For that I want 12 partials ( each of them being represented on screen by a check box member of a radiogroup).
Each partial needs 4 parameters. I wish to make only 4 encoders and not 48 ! (Yes I am lazy)

Depending on the checkbox ticked, the encoder values would be sent to global variables corresponding to the partial number.

Code would be something like :

if changed:k(chnget:k("checkbox_X"))==1 then 
 if chnget:k("checkbox_X")==1 then
    ; check values of encoders and store them into gVariable for partialX
 endif
endif
if changed:k(chnget:k("checkbox_Y"))==1 then 
 if chnget:k("checkbox_Y")==1 then
    ; check values of encoders and store them into gVariable for partialY
 endif
endif

But I afraid that if I save the preset, only one set of value will be saved (i;e; the last value entered into the encoders) and all the other partial will be forgotten.

You can save the states of variables to a text file in Csound. Or you could write them to a function table. Check out some of Iain’s instruments. He doesn’t use the preset system but rolls his own custom preset loading system using Csound. Iain uses macros for this. I try to avoid them at all costs.

I’d start by trying to save the values of different variables to a text file and reloading them again later. If I get a moment later between fatherly duties I’ll see if I can throw a simple example together.

Thank you… Somehow I manage to move forward.
Last question : how can I check if a filebutton configured save snapshot has been pressed and to get the name of the snapshot getting saved ?

Hmm, that may involve some trickery. Let me think about it. You can used a changed opcode to see if the filebutton has been pressed. You might need to use the directory opcode to see if the directory then has more files. But don’t forget I plan to update the preset system to use a single preset file. So I might be able to add something useful when doing that.

Somehow the changed opcode does not respond when filebutton is set to snapshot mode :
if changed:k(chnget:S("filebutton")) == 1 then does not give any signal and if changed:k(chnget:k("filebutton")) == 1 then give an error :

 INIT ERROR in instr 2: channel already exists with incompatible type
#k0	chnget.k	"filebutton"

Right you are. I’ve updated the sources so that a filebutton set to “snapshot” mode will now send the name of the most recent snapped file to its associated channel. Rebuild and give it a whirl.