[linux-audio-dev] Basic MIDI question

Jacob jacob01 at gmx.net
Tue Jul 25 19:55:32 UTC 2006


Hmmm, does this really work? I don't think so.

Example:

   1. status: note on   (-> thisByte -> runningStatus)
   2. data:   key       (-> thisByte, ignored)
   3. data:   vel       (-> thisByte, checked against 0, checked againt 0x80)
   4. status: note off  (read as key !!!)
   5. data:   key       (read as vel, checked against 0x80 !!!)
   6. data:   vel       (read as key !!!)
   7. status: note on   (read as vel, checked against 0x80 !!!)

The Problem is, that the second data byte is used for the running status
byte test.

Yours,

Jacob

On Tue, Jul 25, 2006 at 07:00:54PM +0200, Jens M Andreasen wrote:
> Bzzzt ... My wrong!
> 
> 
> thisByte = nextByte();
> 
> for(;;)
> {
> 
>   if(thisByte & 0x80)
>      runningStatus = thisByte;
> 
>   //... after which we get that:
> 
>   if(runningStatus == NOTE_ON || runningStatus == NOTE_OFF)
>   {
>     thisByte = nextByte();
>     thisByte = nextByte();
> 
>     // note_on with zero velocity is note_off
>     if(thisByte == 0 || runningStatus == NOTE_OFF)
>       setLed(NOTE_OFF);
>     else
>       setLed(NOTE_ON);   
>   }
>   else
>     thisByte = nextByte();
> }
> > > Lee
> > > 
> -- 
> 



More information about the Linux-audio-dev mailing list