[sdiy] Midi problems
Andre Majorel
amajorel at teaser.fr
Thu Apr 4 01:51:12 CEST 2002
On 2002-04-03 23:37 +0100, Paul Maddox wrote:
> simple trick, if the MSB is set, REMEMBER the byte (call it running_status)
> if you get ANY other byte with the MSB set, forget the running_status byte
> as the data that follows is for some other channel.
Some bytes with the MSB set don't count for running status.
> watch out for CLOCK data though :-) it can arrive at ANY point.. so if you
> dont plan on useing it make sure you have a filter setup, so if midi clock
> arrives it simply gets ignored and nothing is done with it (dont change the
> counter value either!)
Yes, and not only clock !
Status bytes F8h - FFh (as you said clock, but also tick, start,
continue, stop, sense and reset) are called real time messages.
They have no data byte and they have two unique properties :
- they can intervene *inside* other messages,
- they're not eligible for running status.
So the correct way to handle running status is :
unsigned char running_status = 0;
for (;;)
{
...
unsigned char b = getc (midi_fp);
...
if (b >= 0x80 && b < 0xf8)
running_status = b;
...
}
--
André Majorel <amajorel at teaser.fr>
http://www.teaser.fr/~amajorel/
More information about the Synth-diy
mailing list