[CM] Receiving from portmidi

Fernando Lopez-Lezcano nando at ccrma.Stanford.EDU
Sun, 02 Dec 2007 20:36:35 -0800

On Sun, 2007-12-02 at 09:41 -0600, Rick Taube wrote:
> sorry forget to append test code that shows how to use it:
> ;----------------------------------------------------
> (in-package cm)
> (use-system :portmidi)
> (pprint (pm:GetDeviceInfo ))
> (defparameter pm (portmidi-open :input 1 :output 2))
> (recv pm)
> (recv? pm)
> ;; printout may or may not work under the callback depending on your
> ;; lisp. if not then look at mymessages to see if it worked.
> (defparameter mymessages (list))
> (recv-set! pm (lambda (m) (print m) (push m mymessages ) ))
> (print mymessages)
> (mapcar #'(lambda (m) (midi-print-message m 0)) mymessages)
> (recv-stop pm)

Using cffi-070221 + last week's cm svn + portmidi 2.0.2:

The example above prints numbers when a keyboard is connected
appropriately. So the low level portmidi appears to be working. 


Portmidi from _Common Music_ is not working, when I try to execute an
example I get exactly the same error message as reported before. 

This is what I wrote last week:

> This used to work. AFAICT *receive-methods* in io.lisp/io.scm is nil
> and never initialized, as long as it is nil nothing will happen. None
> of the receiver examples work (tried with today's svn and current
> portmidi and rts tarballs). 

Unless I'm missing something this seems to be a problem in the _cm_ 
codebase, not in the portmidi codebase. There's functions missing in
cm as well as in portmidi (which I did not notice as we did not even
get to the underlying portmidi layer before). Otherwise I don't see how
that variable gets initialize to something not nil. If it is nil then
the error described in the thread is triggered. 

-- Fernando