Hello, have an issue here. When triggering an instrument with the event
opcode, the value from a variable seems to reset to 0 inside the instrument? Hope someone can take a look at it
<Cabbage>
form caption("Test") size(650, 550), guiMode("queue"), pluginId("Test"), opcodeDir("."), presetIgnore(1)
keyboard bounds(201, 385, 400, 100) channel("keyboard10049")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-dm0 -n -+rtmidi=null -M0 -Q0 --midi-key=4 --midi-velocity=5
</CsOptions>
<CsInstruments>
ksmps = 128
nchnls = 2
0dbfs = 1
// Listens to all MIDI channels
instr 1
cabbageMidiSender // Send midi events to cabbageMidiListener opcode..
endin
// Midi instrument
instr 2
kNotes[], kVels[], kChns[], kCnt cabbageMidiListener 1
kTrig = metro(1)
kNote = kNotes[0]
printk2 kNote
if (kNote != 0 && kTrig > 0) then
// Trigger test-tones
event "i", 100, 0, 1, i(kNote), 1
endif
endin
// Oscillator
instr 100
print p4
iGain = p5/127
kEnv expon iGain, p3, 0.001
aOut oscili kEnv, cpsmidinn(p4)
outs aOut, aOut
endin
</CsInstruments>
<CsScore>
i2 0 z
</CsScore>
</CsoundSynthesizer>