Cabbage Logo
Back to Cabbage Site

How to avoid is_playing send a 1 when i press stop in transp. bar

Hello people, im new in cabbage. I am having issues while i am using my cabbage vst in reaper. I need to trigger the csound score with the scoreline opcode when i press the play button in the transport bar, but it also triggers when i stop it. I spent several hours trying to find a solution but i didnt. The csd file is this…

<Cabbage>
form    size(1000, 600), caption("instr"),   pluginid("plu1"),   colour(0, 120, 120)
csoundoutput    bounds(0, 0, 1000, 150)
texteditor  bounds(0, 150, 1000, 30),   channel("texteditor1"), colour(120, 120, 0)
textbox bounds(0, 180, 1000, 220),  file("test2.csd")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
sr = 88200
ksmps = 1
nchnls = 2
0dbfs = 1

gisine  ftgen   0, 0, 4096, 10, 1

instr   99
Str    chnget  "texteditor1"
krec   chnget  "IS_PLAYING"
ktrig   changed krec
scoreline   Str, ktrig  
endin

instr   1
asig    poscil3 1, 441, gisine
outch   1, asig, 2, asig
endin
</CsInstruments>
<CsScore>
i   99  0   z
e
</CsScore>
</CsoundSynthesizer>

I know where is the problem but i don’t know how to solve it!!

Sorry for my bad english.
Cabbage is awesome!

thanks

Check for changed AND if the value of IS_PLAYING is 1. That should work. Changed is triggering on a 0 and 1, that’s the problem.

Thank you very much rory. I solved it that way.

<Cabbage>
form    size(1000, 600), caption("instr"),   pluginid("plu1"),   colour(0, 120, 120)
csoundoutput    bounds(0, 0, 1000, 150)
texteditor  bounds(0, 150, 1000, 30),   channel("texteditor1"), colour(120, 120, 0)
textbox bounds(0, 180, 1000, 220),  file("test2.csd")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
sr = 88200
ksmps = 1
nchnls = 2
0dbfs = 1

gisine  ftgen   0, 0, 4096, 10, 1

instr   999

Str    chnget  "texteditor1"
krec   chnget  "IS_PLAYING"
ktrig  changed krec
if     (krec = 1 && changed(krec) = 1) then
ktrig   =   1
else
ktrig   =   0
endif
scoreline   Str, ktrig
endin

instr   1
asig    poscil3 1, 441, gisine
outch   1, asig, 2, asig
endin
</CsInstruments>
<CsScore>
i   999  0   z
e
</CsScore>
</CsoundSynthesizer>

This is getting better al the time!
Thanks!!!

1 Like