Subject: Re: midi stuff
To: Andrew Kilpatrick <andrew@andrewkilpatrick.org>
From: Gavan Fantom <gavan@coolfactor.org>
List: tech-kern
Date: 04/16/2001 10:26:16
On Sun, 15 Apr 2001, Andrew Kilpatrick wrote:
> I'm working MIDI and audio software for NetBSD. The midi input function
> seems to choke when I send a lot of aftertouch commands.
Ouch.
I'm just wondering why I haven't been bitten by this, since I'm using a
Yamaha WX wind controller. That sends a fair amount of continuous data.
> In midi.c the midi_in() function uses a variable called sc->in_pos
> which it uses to keep track of which byte of a message it's on. It's
> writing into a buffer that is only 3 bytes long, but when I use
> aftertouch (which happens almost all the time when I play on my keyboard)
> the in_pos never resets, and just keeps counting up and up, eventually
> crashing the system.
Do you get lots of messages on the console saying something like "midi_in:
buffer full, discard data=..."?
Looking at the code (in NetBSD 1.5 - what are you using?) it seems like
the buffer is protected from overflow by sc->in_left.. when this reaches
zero, the content of the buffer is delivered. If more data comes in in the
meantime, running status is applied and in_left is reset to the length of
the expected command.
Are you sure that sc_pos is counting up? Could you define AUDIODEBUG and
set mididebug >=3 and post the output in the failure case?
> I thought I may have found the problem, but was being confused because
> I didn't fully understand some of the things that my keyboard was
> sending. I was mistaking some of the messages for errors, when in fact
> they were valid MIDI data.
Again, some actual data to work on would be useful.
--
Gillette - the best a man can forget