Commit d99efe45 authored by Brandon Invergo's avatar Brandon Invergo

Update device.scm to use new MIDI symbols, use midi: prefix

parent 0bf1e273
......@@ -43,7 +43,7 @@
(librekontrol core)
(librekontrol alsa)
(librekontrol input)
(librekontrol midi))
((librekontrol midi) #:prefix midi:))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Defining "control" structures and mapping them to callback ;;
......@@ -160,17 +160,17 @@ the ctl (i.e. turn the LED on or off).
Optional keyword arguments:
#:channel -- MIDI channel on which to send the event (default: 0)
#:note -- MIDI note to send (default: midi-note-c4)
#:note -- MIDI note to send (default: note-c4)
#:velocity -- velocity of the note (default: 127)"
(let-keywords options #f ((channel 0)
(note 'midi-note-c4)
(note 'midi:note-c4)
(velocity 127))
(if (> input-value 0)
(begin
(send-midi-noteon device channel (midi-note->number note) velocity)
(send-midi-noteon device channel (midi:note->number note) velocity)
(set-ctl alsa-ctl #t))
(begin
(send-midi-noteoff device channel (midi-note->number note) velocity)
(send-midi-noteoff device channel (midi:note->number note) velocity)
(set-ctl alsa-ctl #f)))))
(define* (make-midi-note-button-toggle #:optional (init-state #f))
......@@ -181,22 +181,22 @@ ctl, toggle the ctl (i.e. turn the LED on or off).
Optional keyword arguments:
#:channel -- MIDI channel on which to send the event (default: 0)
#:note -- MIDI note to send (default: midi-note-c4)
#:note -- MIDI note to send (default: midi:note-c4)
#:velocity -- velocity of the note (default: 127)"
(let ((state init-state))
(lambda (device input-event input-value alsa-ctl options)
(let-keywords options #f ((channel 0)
(note 'midi-note-c4)
(note 'midi:note-c4)
(velocity 127))
(begin
(when (> input-value 0)
(if (not state)
(begin
(send-midi-noteon device channel (midi-note->number note)
(send-midi-noteon device channel (midi:note->number note)
velocity)
(set! state #t))
(begin
(send-midi-noteoff device channel (midi-note->number note)
(send-midi-noteoff device channel (midi:note->number note)
velocity)
(set! state #f)))
(toggle-ctl alsa-ctl)))))))
......@@ -529,7 +529,7 @@ Optional keyword arguments:
(knob-max 127))
(when (eq? (car input-event) ev-abs)
(let* ((value (scale-value input-value knob-max 127)))
(send-midi-control device channel (midi-control->number control) value))
(send-midi-control device channel (midi:control->number control) value))
(set-ctl alsa-ctl #t))))
(define* (make-rel-to-abs-midi-control-knob #:optional (init-value 0))
......@@ -553,7 +553,7 @@ Optional keyword arguments:
(value (cond ((< new-value 0) 0)
((> new-value 127) 127)
(#t new-value))))
(send-midi-control device channel (midi-control->number control) value)
(send-midi-control device channel (midi:control->number control) value)
(set! prev-value value)
(set-ctl alsa-ctl #t)))))))
......@@ -565,10 +565,10 @@ the ctl appropriately.
Optional keyword arguments:
#:channel -- MIDI channel on which to send the event (default: 0)
#:note -- MIDI note to send (default: midi-note-c4)
#:note -- MIDI note to send (default: midi:note-c4)
#:pad-max -- pad event maximum value (default: 127)"
(let-keywords options #f ((channel 0)
(note 'midi-note-c4)
(note 'midi:note-c4)
(pad-max 127))
(let* ((velocity (scale-value input-value pad-max 127))
(ctl-value
......@@ -578,8 +578,8 @@ Optional keyword arguments:
(not (= 0 input-value)))))
(if (> input-value 0)
(begin
(send-midi-noteon device channel (midi-note->number note) velocity)
(send-midi-noteon device channel (midi:note->number note) velocity)
(set-ctl alsa-ctl ctl-value))
(begin
(send-midi-noteoff device channel (midi-note->number note) 0)
(send-midi-noteoff device channel (midi:note->number note) 0)
(set-ctl alsa-ctl ctl-value))))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment