[linux-audio-dev] Basic MIDI question

Jens M Andreasen jens.andreasen at chello.se
Wed Jul 26 11:56:20 UTC 2006

On Wed, 2006-07-26 at 09:51 +0300, Ari Kauppi wrote:
> On Wed, 26 Jul 2006, Jens M Andreasen wrote:
> >      if(runningStatus == NOTE_ON || runningStatus == NOTE_OFF)
> If you plan to receive messages from other channels than 0 you have to 
> use (runningStatus & 0xF0) instead of the full runningStatus and perhaps 
> check for (runningStaus & 0x0F) == receiveChannel..

In this case I think we can get by without increasing instruction count,
like this:

      if((runningStatus - NOTE_OFF) < 0x20) // note_on or note_off

... and keep switch(runningStatus & 0xF0) in mind for an extension.

The receive channel is better handled in the note on/off function(s).
There can be all kinds of differences between channels that the parser
need not to have any knowledge of.

If this is going to be some kind of Official Blinking Light Parser
Contest, I better do an explicit rewrite so it can compile :-)

Those who chip in, get to share the prize!

More information about the Linux-audio-dev mailing list