mu:test   macro


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

Implementation

;
;
;; MU:TEST 
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Test MIDI channel with a note 
;
;; both with/without time abstractions
;; Variable num of args
;; MIDI channel is 1-based
;; IMPORTANT need *mididevice*  to be predefined 
;
; Example:
; (define *mididevice* (pm_create_output_stream 1))
; (mu:test 38) ; MIDI channel defaults to 1
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(impc:aot:do-or-emit
   (define-macro (mu:test . args)
      (cond ((length-equal? args 1) ;; just note
            `(play-midi-note (now) *mididevice* ,(car args) 80 *second* 0))
            ((length-equal? args 2) ; note and midi ch
            `(play-midi-note (now) *mididevice* ,(car args)  80 *second* (- ,(cadr args) 1)))
            ((length-equal? args 3) ;; also mididevice
            `(play-midi-note (now) ,(car args) ,(cadr args)  80 *second* (- ,(caddr args) 1))) 
            (#t (print 'Error: '1 'or '3 'args' 'max))))
)


Back to Index

Similar Entries