scheme-midi-listener   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/midi.xtm

Implementation

;; scheme midi event listener
(define scheme-midi-listener
  (lambda (beat dur)
    (dotimes (i (available_midi_events))
      (let* ((evt (dequeue_midi_event))
            (type (get_midi_evt_type evt))
            (a (get_midi_evt_a evt))
            (b (get_midi_evt_b evt))
            (chan (get_midi_evt_channel evt))
            (timestamp (get_midi_evt_timestamp evt)))
        (cond ((= type #x90)
              (midi-note-on timestamp a b chan))
              ((= type #x80)
              (midi-note-off timestamp a b chan))
              ((= type #xB0)
              (midi-cc timestamp a b chan))
              (else #f))))
    (callback (*metro* (+ beat (* .5 dur))) 'scheme-midi-listener (+ beat dur) dur)))


Back to Index