Re: MIDI parser source (bytestream->MIDI messages)
Christian Packmann <[email protected]> Wed, 28 Jan 2004 00:13:28 +0100
| Newsgroups | gmane.os.openbeos.midi |
|---|---|
| Message-ID | <[email protected]> |
Matthijs Hollemans wrote: > > any hints where I can find source code which takes a raw byte stream=20 > > and parses it into MIDI messages? >=20 > The midi_server does something like that already. The code is in=20 > PortDrivers.cpp. It appears to work on at least some systems, but it is= =20 > not finished yet. The code to split the raw bytes into MIDI message is=20 > actually pretty simple: > http://cvs.sourceforge.net/viewcvs.py/open-beos/current/src/servers/mid= i/PortDrivers.cpp Thanks! That will help alot - having the switch() and case statements=20 written out saves a lot of typing. :) But I think there's a bug, or rather a missing workaround, in the code.=20 IIRC, some MIDI units don't send proper End-Of-SysEx messages (e.g. Yamah= a=20 DX7), and might simply send normal channel messages after a SYX-dump. So=20 the code should sense that the SYX-dump is complete after reading any byt= e=20 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=20 > only intended to be used by device drivers. I don't know how it works, = or=20 > 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= =20 it is (supposed to be) located? I currently don't have time to dig throug= h=20 the CVS tree... =20 >> [...] there already is serial_midi, but it only does MIDI-Out, not >> MIDI-In, and this isn't acceptable. >=20 > Hmm, I didn't know that. I found out the hard way. With a self-made cable, which I resoldered n=20 times. Desperation. Then I tried out a CBX driver under Windows, which ga= ve=20 me MIDI-In on the first try... <sob> > You could always write a replacement driver for=20 > serial_midi, of course :-) Then the midi_server will take care of parsi= ng=20 > the raw byte stream. Hmm, later maybe. AFAIK OBOS will get a new driver system anyway, so it=20 might be better to wait 'til then. And I don't have any experience with=20 writing kernel drivers yet, and am still a bit respectful of that... Bye, Chris