Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if {0} {
- control selected drones from midi slider/knob
- copyright (c) 2011 S Jagannathan.
- released under GPL 2.0.
- }
- proc assign-drones {cc} { ;# assigns selected drones to midi cc
- set sel [get-drone selected] ;# get selected drones
- ;# set cc as dronal array variable's index
- ;# and store selected drones & their initial volumes
- global dronal
- set dronal($cc) [list $sel [get-drone volume $sel]] ;# get-drone is din built in command
- }
- proc midi-cc {status cc value} { ;# called when user operates midi controller
- global dronal
- foreach ass [array names dronal] {
- if {$cc eq $ass} { ;# cc matches one of our drones assignments
- set pair $dronal($ass) ;# get drones & initial volumes for this assignment
- set drones [lindex $pair 0] ;# get the attached drones
- set vols [lindex $pair 1] ;# get the initial volumes
- ;# run thru the drones list and assign volume from 0 to initial drone volume based on midi
- ;# slider position
- for {set i 0; set j [llength $drones]} {$i < $j} {incr i} {
- set idrone [lindex $drones $i]
- set ivol [lindex $vols $i]
- set-drone volume $idrone [getval 0 $ivol $value] ;# set-drone is din built in command
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement