Cabbage Logo
Back to Cabbage Site

Changing an objects properties with a slider

Hey, is it possible to somehow change the properties of an object (such as the trackercolour of a slider) based on the output of another object?

For example, if I have a slider for feedback in a delay plugin, I want to make the trackercolour fade from green to red as the feedback amount gets higher.

Is this possible?

Thanks.

Yes it’s possible. You’ll need to use identifier channels. Let me know if you need any help with it.

<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginid("def1")
rslider bounds(20, 12, 100, 100), channel("gain"), range(0, 1, .5, 1, .01), text("Gain"), style("normal"), identchannel("slider1Ident")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d 
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1

instr 10
    k1 oscil 1, .1
    if metro(10) ==  1 then
        SMessage sprintfk "trackercolour(30, %d, 30)", abs(k1)*255
        chnset SMessage, "slider1Ident"
    endif
endin

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
i10 0 z
</CsScore>
</CsoundSynthesizer>

For some reason this doesn’t work for me… I copied your code even, and the colour doesn’t change at all. What do : (
I’m on Cabbage(64bit) v2.0.03 on MacOS 10.14.3 (18D109)

Can you try this version for Windows, or this one for OSX. These are the latest beta packages. Best to update to this first as the problem you are seeing might already be resolved. Also make sure that you have selected a valid audio card as performance won’t start if Cabbage is not connected to an audio device. :wink: