Hello,
I’m testing out some things, and I was wondering if anyone has any tips on how I could temporarily freeze the value of a variable (kGain_2) when changing a slider. As soon as I stop changing the parameter, I want it to jump back to the correct value.
Something like this, but I can’t get it to work:
<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue") pluginId("def1")
rslider bounds(296, 162, 100, 100), channel("gain"), range(0, 1, 0, 1, .01), text("Gain"), trackerColour("lime"), outlineColour(0, 0, 0, 50), textColour("black")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
kGain, kGainTrig cabbageGetValue "gain"
kGain_2 init 0.5
if changed2(kGain) == 1 then
kGain_2 = kGain_2
else
kGain_2 = kGain
endif
printk2 kGain_2
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7]
</CsScore>
</CsoundSynthesizer>