:mix   macro


Defined in:  https://github.com/lambdamusic/extempore-extensions/blob/main/init/init_mixer.xtm

Implementation

;
;; :mix - control Ableton LIVE mixer channels via MIDI CC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Args:
; -----
; Takes variable num of args, but for 4:  
; track: the Ableton Track number (1-8, 10 for master)
; action: +/- for increment/decrement 
; value: [INTEGER or FLOAT 0-127] the fader value number
; boundary: the min or max value where to stop
;
; Notes:
; ------
; TRACK 1-8 only allowed 
; TRACK 10 => the MASTER vol in ABLETON
; Values are set in real-time using now() // [not beat]
; IMPORTANT: communication is one-way only XTM=>DAW (not back-synced from DAW)
;
; DEFAULT MIN = 0 
; DEFAULT MAX = 90 
;
; Example:
; --------
;; (:mix)            -- show all active values
;; (:mix 'all)       -- show all active values (alias)
;; (:mix 1)          -- [1 arg]: show current cached value for channel 1 
;; (:mix 1 10)       -- [2 args]: set channel 1 to 10 (up to DEFAULT MAX)
;; (:mix 'all 10)    -- [2 args]: set all channels to 10 
;; (:mix 1 '+ 1)     -- [3 args]: increment channel 1 by 1 (up to DEFAULT MAX)
;; (:mix 1 '+ .5)    -- [3 args]: increment channel 1 by 0.5 (up to DEFAULT MAX)
;; (:mix 1 '- 1)     -- [3 args]: decrement channel 1 by -1 (up to DEFAULT MIN)
;; (:mix 1 '+ 1 50)  -- [4 args]: increment channel 1 by 1, up to 50
;; (:mix 1 '- 1 10)  -- [4 args]: decrement channel 1 by -1, up to 10 
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(impc:aot:do-or-emit
   (define-macro (:mix . args)
      (cond ((length-equal? args 0)
              ;; eg (:mix)
              (helper:print-mixers-all))
            ((length-equal? args 1) 
                ;; eg (:mix 5) ;; Show VAL for specific channel
            `(helper:inner_mixer ,(car args) 0 'none 'none)) 
            ((length-equal? args 2) 
                ;; eg (:mix 'all 40) => set all to '40'
                ;; eg (:mix 5 10) => set to '10' (min/max=default)
              `(if (equal? ,(car args) 'all) 
                (helper:set-mixer-all ,(cadr args)) 
                (helper:inner_mixer ,(car args) ,(cadr args) ,(cadr args) ,(cadr args)))) 
            ((length-equal? args 3)  
                ;; eg (:mix 5 '+ 1) => increment by '1' (min/max=default)
                ;; eg (:mix 5 '- 1) => decrement by '1' (min/max=default)
             `(if (equal? ,(cadr args) '-) 
                (helper:inner_mixer ,(car args) (- 0 ,(caddr args)) *mixer-lower-limit* *mixer-upper-limit*)
                (helper:inner_mixer ,(car args) ,(caddr args) *mixer-lower-limit* *mixer-upper-limit*)
                ))
            ((length-equal? args 4)  
                ;; eg (:mix 5 '+ 1 20) => increment by '1' till 20
                ;; eg (:mix 5 '- 1 20) => decrement by '1' till 20
             `(if (equal? ,(cadr args) '-)
                (helper:inner_mixer ,(car args) (- 0 ,(caddr args)) ,(cadddr args) *mixer-upper-limit*)
                (helper:inner_mixer ,(car args) ,(caddr args) *mixer-lower-limit* ,(cadddr args))
                ))
            (#t (println "Not enough arguments"))))
)


Back to Index

Similar Entries