Cabbage Logo
Back to Cabbage Site

Cababage Reserved channel / VST


I am trying to understand how the reserved channels work when a patch is exported as a VST in Reaper.
Here is a simple instrument which aims at displaying the BPM off the host… but I don’t get anything.
Could someone explain me why , please?
Thank you for your help.

form caption(“Untitled”) size(400, 300), colour(58, 110, 182), pluginID(“def1”)
numberbox bounds(10, 80, 80, 60), channel(“Numbox”), text(“name”), textbox(120), range(0, 340, 120),identchannel(“NumR”)
; Initialize the global variables.
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
gkTempo init 120
instr 1
gkTempo chnget “HOST_BPM”
if changed(gkTempo)==1 then
SMessage sprintfk “text(”%d")",gkTempo
chnset SMessage,“NumR”

;causes Csound to run for about 7000 years…
;f0 z
i 1 0 3600

That’s quite strange, @rorywalsh - we’re not able to change the text of a numberbox dynamically.

However this code should work fine if you change the value of the numberbox.

You can either do:
SMessage sprintfk "value(%d)",gkTempo chnset SMessage,"NumR"

or more simply, for values, target the channel instead of the identchannel:
chnset gkTempo, "Numbox"

Also, a good practice would be explicitly define the rate of argument you are dealing with in IF blocks to avoid headaches later:
if changed:k(gkTempo)==1 then


It’s working here?

form caption("Numberbox") size(400, 300), colour(20, 20, 20), pluginID("def1")
numberbox bounds(10, 10, 100, 80), channel("numberBox"), range(0, 10, 0)
-n -d -+rtmidi=NULL 
; Initialize the global variables. 
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1
chnset abs(randi:k(10, 1, 2)), "numberBox"

i1 0 10000

Btw, @Karamel1, there is an example of the use of reserved channels in the example folder, under 'Instructional. It’s called Host Info. That should give you a god idea of how they are used.

Oh thank you … I just exported the hostinfo example as a VST synth and tried it into REAPER … It is silent, it shows 0 everywhere…
Somehow cabbage and reaper don’t want to communicate :grin:

I meant the “text” attribute of the numberbox.

Also Rory, the host bpm macro isn’t working when exported through Cabbage 2. It just displays zero. When the same sketch is exported as a plugin through Cabbage 1, it seems to work fine.

Thanks for the report. I’m looking into it now.

@rorywalsh : yes your patch works fine.
However, the macros do not work (I tried both reaper and VSThost with the example Hostinfo)

Ok, text() for numberbox is fixed. Now I need to look into the host channel stuff.

I’ve fixed this issue and re-uploaded the OSX binaries. I’ll add a Windows package later tonight.

Thank you !

New Windows binaries uploaded.