From alsa-devel-owner@alsa.jcu.cz  Tue Jul 28 22:53:00 1998
Received: from entry.jcu.cz (perex@entry.jcu.cz [160.217.1.111])
	by marvin.jcu.cz (8.8.8/8.8.8) with SMTP id WAA09821;
	Tue, 28 Jul 1998 22:50:57 +0200
Date: Tue, 28 Jul 1998 22:50:56 +0200 (MET DST)
From: Jaroslav Kysela <perex@jcu.cz>
To: Frank van de Pol <F.K.W.van.de.Pol@inter.nl.net>
cc: alsa-devel@jcu.cz
Subject: Re: kernel MIDI interface
In-Reply-To: <199807272139.XAA14741@obelix.fvdpol.inter.nl.net>
Message-ID: <Pine.LNX.3.96.980728223732.21432A-100000@entry.jcu.cz>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

On Mon, 27 Jul 1998, Frank van de Pol wrote:

> 
> Hi Jaroslav,
> 
> I've been experimenting with the MIDI interface for kernel modules from the
> alsa-driver-0.2.0-pre2 driver. 
> 
> Playback works great. I get nice tight timing with the ALSA sequencer. Recording
> works ok for MIDI note on/off and program changes.
> 
> With control changes and pitchbend messages I receive an odd sequence.
> Instead of the expected 3 byte message I get 2 messages of 2 bytes. Instead
> of eg. a "bf,6c,xx" message I get a "bf,6c" and a "bf,xx" message. 

I don't have any trouble by me (I tried 0xEx - bender & 0xBx - control).
Maybe this problem is caused by bellow bug (if stream is interleaved with
some common messages).

> For sysex streams I only seem to get the start of sysex and end of sysex
> message and not the actual data (I get "f0,f7").

Oops. I found small typo in receive MIDI stream parser:

--- midi.c.orig Tue Jul 28 22:33:29 1998
+++ midi.c      Tue Jul 28 22:35:23 1998
@@ -117,7 +117,7 @@
   if ( rmidi -> input.u.p.cused == 1 ) {       /* init byte? */
     if ( b & 0x80 ) {                          /* MIDI status byte */
       if ( ( b & 0xf0 ) == 0xf0 ) {            /* common message */
-        tmp = len_tab_c[ b >> 4 ];
+        tmp = len_tab_c[ b & 0x0f ];
         switch ( tmp ) {
           case 254:                            /* wait for next data */
             snd_spin_unlock( rmidi, input, &flags );

This bug should affect parsing all common MIDI commands (0xFx).

> Other thing I noticed: in the alsa-driver-0.1.x series I could do a cat
> /dev/sndmidi00 > file, and get the midi bytes in that file, but now I get no
> data in that file.

You are using bad command... Program cat does output buffering if output
is file (by me 4kB) - try 'dd if=/dev/sndmidi00 of=file bs=1' rather...

						Jaroslav

-----
Jaroslav Kysela <perex@jcu.cz>
Academic Computer Centre, University of South Bohemia
Branisovska 31, C. Budejovice, CZ-370 05 Czech Republic


