[openbeos-midi] Re: Midi2 handling of SysEx data

  • From: "Matthijs Hollemans" <matthijs@xxxxxxxxxxxxxxxxxxx>
  • To: <openbeos-midi@xxxxxxxxxxxxx>
  • Date: Sun, 1 Feb 2004 13:56:30 +0100

Christian wrote:
> I'm working on some SexEx Send/Receive tools, and found out that SysEx
> data handled by Midi2 gets the first and last bytes stripped off.

The OpenBeOS Midi2 kit works exactly like the BeOS R5 kit in that regard.
Which means we can't change that.

However, you can override the Data() hook to look for a sysex yourself. The
data buffer that is passed to Data() does include the control bytes (at
least 0xF0, but not necessarily 0xF7). You would do something like this:

void MyConsumer::Data(.....)
    if (atomic && data[0] == B_SYS_EX_START)
        // do your thing
        // let superclass handle it

See also BMidiLocalConsumer::Data() for hints.

As far as the documentation is concerned, I thought it would be obvious that
the MIDI control bytes (0xF0 and 0xF7) are stripped from the data, since
none of the other callbacks includes control bytes either. I will update the
documentation to make this clearer, though.

By the way, you can get the most up-to-date docs from:

In due time, the docs and other information from that page will be moved to
the new OpenBeOS website.

Hope this helps,

Other related posts: