I was testing to see if I could just attach an ‘nslider’ with a different channel name, but in order to have the ‘nslider’ set the value of the ‘rslider’, which inturn will set the ‘nslider’. This creates an infinite loop. Is there a way to set the value of a widget that won’t propagate the event? PureData allows you to ‘set’ the value that won’t pass on the event.
<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
rslider bounds(140, 32, 36, 36) channel("vox1octave") range(-4, 4, 0, 1, 1)
rslider bounds(176, 32, 36, 36) channel("vox1interval") range(-12, 12, 0, 1, 1)
nslider bounds(136, 64, 44, 20) channel("vox1octaveN") range(-4, 4, 0, 1, 1) colour(0, 0, 0, 0)
keyboard bounds(8, 158, 381, 95)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
;instrument will be triggered by keyboard widget
instr 1
kVox1Octave, kVox1OctaveTrig cabbageGetValue "vox1octave"
kVox1OctaveN, kVox1OctaveNTrig cabbageGetValue "vox1octaveN"
if kVox1OctaveTrig == 1 then
printks "getting kVox1Octave (%d)\n", 0, kVox1Octave
cabbageSetValue "vox1octaveN", kVox1Octave
endif
if kVox1OctaveNTrig == 1 then
printks "getting kVox1OctaveN (%d)\n", 0, kVox1OctaveN
; with the following, an infinite loop would occur
; cabbageSetValue "vox1octave", kVox1OctaveN
endif
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
i 1 0 -1
f0 z
</CsScore>
</CsoundSynthesizer>
Maybe something like this, it’s a solution that addresses a specific problem. All this would do is set the value of the widget, but won’t trigger an event.
cabbageSet kVox1OctaveNTrig, "vox1octave", "value", kVox1OctaveN