Ok, so I managed to save the native presets to an external file. However, I’m having trouble getting to read a file, not sure if it’s possible. Here’s the code for both (save / open)…
<Cabbage>
form caption("Presets Named 2") size(340, 240), guiMode("queue"), colour(58, 110, 182), pluginId("pn02")
rslider bounds(20, 20, 60, 60), channel("att"), range(0, 1, 0.01), text("Att.")
rslider bounds(100, 20, 60, 60), channel("dec"), range(0, 1, 0.4), text("Dec.")
rslider bounds(180, 20, 60, 60), channel("sus"), range(0, 1, 0.7), text("Sus.")
rslider bounds(260, 20, 60, 60), channel("rel"), range(0, 1, 0.8), text("Rel.")
combobox bounds(100, 120, 100, 20), channel("list"), populate("*.snaps"), channelType("string")
filebutton bounds(20, 120, 60, 20), channel("savep"), text("Preset"), populate("*.snaps"), mode("named snapshot")
filebutton bounds(220, 120, 60, 20), channel("savef"), text("Save"), mode("save")
filebutton bounds(20, 160, 60, 20), channel("open"), text("Open"), mode("file")
filebutton bounds(20, 200, 60, 20), channel("remove"), text("Remove"), populate("*.snaps", "test"), mode("remove preset")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
gSSave, kts cabbageGetValue "savef"
gSOpen, kto cabbageGetValue "open"
if kts == 1 then
event "i", "Save", 0, 1
endif
if kto == 1 then
event "i", "Open", 0, 1
endif
endin
instr Save
SFromPreset fileToStr "PN02.snaps"
iRes strToFile SFromPreset, gSSave, 0
endin
instr Open
SToPreset fileToStr gSOpen
iRes strToFile SToPreset, "PN02.snaps", 0
turnoff2 1, 0, 0
event "i", 1, 0, 1
endin
;
</CsInstruments>
<CsScore>
i1 0 z
</CsScore>
</CsoundSynthesizer>
I’m getting some running messages in the Cabbage console as soon as I choose an item in the combobox, so I’m sure there’s something I’m missing. Also, (haven’t tested this yet to confirm), I think I can pass the file back to the local path of the .csd file but I can’t manage to have the patch recognize it unless I stop and start the instrument again?
I’ll be in and out today so my responses will continue to be sporadic, but will get to the forum as soon as I get a chance!
Thanks very much for your time Rory