[openbeos-midi] Re: MIDI parser source (bytestream->MIDImessages)

  • From: Christian Packmann <Christian.Packmann@xxxxxx>
  • To: openbeos-midi@xxxxxxxxxxxxx
  • Date: Wed, 28 Jan 2004 00:13:28 +0100

Matthijs Hollemans wrote:
> > any hints where I can find source code which takes a raw byte stream 
> > and parses it into MIDI messages?
> The midi_server does something like that already. The code is in 
> PortDrivers.cpp. It appears to work on at least some systems, but it is 
> not finished yet. The code to split the raw bytes into MIDI message is 
> actually pretty simple:
> http://cvs.sourceforge.net/viewcvs.py/open-beos/current/src/servers/midi/PortDrivers.cpp

Thanks! That will help alot -  having the switch() and case statements 
written out saves a lot of typing. :)

But I think there's a bug, or rather a missing workaround, in the code. 
IIRC, some MIDI units don't send proper End-Of-SysEx messages (e.g. Yamaha 
DX7), and might simply send normal channel messages after a SYX-dump. So 
the code should sense that the SYX-dump is complete after reading any byte 
with 0x80 set - SysEx data bytes are always only 7 bit.

> There is also supposed to be a midi_parser kernel module, but this is 
> only intended to be used by device drivers. I don't know how it works, or 
> whether we already have it in the OpenBeOS CVS.

Didn't find it, but I only had time for a quick look. Anybody knows where 
it is (supposed to be) located? I currently don't have time to dig through 
the CVS tree...
>> [...] there already is serial_midi, but it only does MIDI-Out, not
>> MIDI-In, and this isn't acceptable.
> Hmm, I didn't know that.

I found out the hard way. With a self-made cable, which I resoldered n 
times. Desperation. Then I tried out a CBX driver under Windows, which gave 
me MIDI-In on the first try... <sob>

> You could always write a replacement driver for 
> serial_midi, of course :-) Then the midi_server will take care of parsing 
> the raw byte stream.

Hmm, later maybe. AFAIK OBOS will get a new driver system anyway, so it 
might be better to wait 'til then. And I don't have any experience with 
writing kernel drivers yet, and am still a bit respectful of that...


Other related posts: