denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Denemo-devel] Scheme question


From: Richard Shann
Subject: Re: [Denemo-devel] Scheme question
Date: Sun, 09 Nov 2014 18:04:09 +0000

On Sun, 2014-11-09 at 18:07 +0100, Andreas Schneider wrote:
> How can I convert the byte list from (d-GetMidi #f) to something that I
> can issue to d-PutMidi? I was not able to come up with something usable.

(let* ((midi (d-GetMidi #f))
        (value #f)
        (command (list-ref midi 0))
                (note (list-ref midi 1))
                        (velocity (list-ref midi 2)))
        (set! value (+ (ash velocity 16) (ash note 8) command))
        (d-PutMidi value))

I think the values required in d-PutMidi are in the opposite to expected
order (packed inside the integer).
It would be good to have a wrapper that takes the three numbers and
executes d-PutMidi after doing the (set! value (+ (ash velocity 16) (ash
note 8) command)) step, thus hiding the poor design of d-PutMidi (if I'm
right about the order of the bytes).

Richard





reply via email to

[Prev in Thread] Current Thread [Next in Thread]