Which version of cabbage do you use ?
Here is a little instrument which should work with a controller (check controller number first).I tested it … it works…
<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginID("def1")
vslider bounds(70, 10, 75, 100) range(0, 1, 0.5,1, 0.1) channel("gain") text("Depth") valuetextbox(1) trackercolour("lime") outlinecolour(0, 0, 0, 50) textcolour("black")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5 ;--midi-key-cps=4
</CsOptions>'
<CsInstruments>
; Initialize the global variables.
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
gkDepth init 1
instr GetCtrl
kCtrler20 ctrl7 1,20,0, 127
if changed(kCtrler20)== 1 then
; Controller sends values between 0 and 127
; bring the value between 0 and 1
kDepth0 = kCtrler20 / 127.0
; set the value of the slider
chnset kDepth0,"gain"
endif
if changed:k(chnget:k("gain"))==1 then
;get the value of the slider
gkDepth = chnget:k("gain")
endif
endin
instr 1 ; controle midi
/* Note the --midi- option in <CsOptions>
Note that there are 2 variables, kDepth0 and kDepth, in order to avoid conflicts between reading and writing
Not sure this is mandatory.
Do what you wanna do with gkDepth starting here
i.e. : modulate amplitude of VCO2
*/
aOut vco2 p5*gkDepth,p4
outs aOut, aOut
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] ; not needed as midi message are sent to instr 1 by default.
i "GetCtrl" 0 z ; listen to controlers
</CsScore>
</CsoundSynthesizer>