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”
endif
endin
;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
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
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.