form caption("Algorythm Sequencer") size(400, 300), colour(25, 25, 25), pluginID("def1")
groupbox text("Steps"), bounds(5, 170, 390, 105), visible(1), identchannel("Steps") plant("Steps"){
checkbox channel("Sel1"), identchannel("sel1"), bounds(10, 25, 30, 30), shape("circle"), colour:1("red"), value(1)
checkbox channel("Sel2"), identchannel("sel2"), bounds(50, 25, 30, 30), shape("circle"), colour:1("red"), value(0)
checkbox channel("Sel3"), identchannel("sel3"), bounds(90, 25, 30, 30), shape("circle"), colour:1("red"), value(1)
checkbox channel("Sel4"), identchannel("sel4"), bounds(130, 25, 30, 30), shape("circle"), colour:1("red"), value(0)
}
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
; Initialize the global variables.
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
; instrument that keeps track of which step you're currently editing
giNumSteps init 4
giSelCurrent init 0
gSSelChanName[] fillarray "Sel1", "Sel2", "Sel3", "Sel4"
gSSelIdntName[] fillarray "sel1", "sel2", "sel3", "sel4"
giSel[] init 16
instr StepSelect
; loop through steps retrieving channels
iStep init 0
while (iStep < giNumSteps) do
giSel[iStep] chnget gSSelChanName[iStep]
iStep += 1
od
; loop through step selectors to see which one is lit that previously wasn't
iStep = 0
while (iStep < giNumSteps) do
iSel = giSel[iStep]
; if this steps selector is set to 1
if (iSel == 1) then
; if this step wasn't already the currently selected step
if (iStep != giSelCurrent) then
; loop through step-select channels, zeroing all
ii = 0
while (ii < giNumSteps) do
chnset "value(0)", gSSelIdntName[ii]
chnset "value(0)", "sel1"
iVal chnget gSSelChanName[ii]
print ii
print iVal
ii += 1
od
; change the step that was just selected back to one and store as currently selected step
chnset "value(1)", gSSelIdntName[iStep]
giSelCurrent = iStep
endif
endif
iStep += 1
od
schedule "StepSelelct", 0.1, 0.1
endin
f0 z
i"StepSelect" 0 0.1
;i"StepSelect" 0.1 0.1