I start again feeling like a csound noob, so i post my problem here…
I want to call a instrument depending on the values of two buttons but it’s not working and i don’t know why. Maybe someone can check this out and help me. I just can’t see it. I already tried out several options.
Here is the example:
instr 1 ; widget controlls
gkAmp cabbageGetValue "amp"
gkDelTime chnget "delTime"
;gkTrig init 0
gkTrig chnget "trig"
printk2 gkTrig
gkTrig port gkTrig, 0.001
gkPanState chnget "pan"
gkPanState init 0
;gkRndDelTime init 0
gkRndDelTime chnget "rndDelTime"
printk2 gkRndDelTime, 50
; if gkRndDelTime == 1 && gkTrig == 1 then
; event "i", 2, 0, 1
; endif
if gkRndDelTime == 1 then
if gkTrig == 1 then
event "i", 2, 0, 1
endif
endif
endin
instr 2
prints "HELLO\n"
turnoff
endin
You want instrument 2 to start if gkRndDelTime and gkTrig are 1? You will need to use the changed opcode, or for convenience, just use the trigger output from cabbageGetValue. Something like this does the trick:
instr 1 ; widget controlls
kTrigButton, kTrigTrig cabbageGetValue "trig"
kRndDelTime, kRndDelTrig cabbageGetValue "rndDelTime"
if kRndDelTrig+kTrigTrig > 0 then
//instr 2 will only play if both buttons are in the on position
if kRndDelTime == 1 && kTrigButton == 1 then
event "i", 2, 0, 1
endif
endif
endin
instr 2
prints "HELLO\n"
turnoff
endin
I want something to happen if gkDelTime is equal to the gkEnvAim value.
So basically i want trigger an event when the expseg opcode reached his final value.
Thank you!
There was also the problem that i used an expseg and in the nature of exponentiell functions it will never reach the final value…So the if statement didn’t also work with that.