I’ve noticed that upon removing a preset (with Cabbage’s built-in preset system), all audio and instances of instruments are automatically turned off. How is this made possible?
I have been trying to figure out a way to recreate this behavior when performing other preset-related actions, such as selecting a preset from a combobox or initializing all the parameters, but haven’t found any success. For example, here is something I tried (for context, this is meant for a initialization button):
gkinit chnget "Init"
if (changed2(gkinit) == 1) then
event "i", 1003, 0, .1 ;instr that initializes all widgets
turnoff2 10, 8, 0.02 ;attempt to turn off all instances of MIDI-receiving instr
clear gareverb ;clear global reverb variable
endif
While this approach does turn off any notes that are being sustained (by my fingers on the keyboard) and clears the reverb variable, it fails to turn off notes that are in their release state (if a note has a long release, it lingers while changing timbre as the widgets are reset). I’ve also run into some weird glitches when using this method, perhaps caused by the combination of all the widgets being set to different values in such a short amount of time and instruments/events still running while those changes take place.
So hmmmm what’s the secret behind the “remove preset” button?