this thread missguided me a bit at first, so here’s the result of my research and emails to TK:
-MPROC_Notify_ReceivedByte receives EVERY byte of incoming MIDI-data (status bytes and data bytes). also the bytes later passed to MPROC_Notify_ReceivedEvent
-MPROC_Notify_ReceivedEvent receives all channel-voice and channel-mode messages
[glow=red,2,300]so this quote is completly wrong:[/glow]
MPROC_Notify_ReceivedByte(unsigned char byte) is only called for single byte events, such as realtime messages (for example), whereas MPROC_Notify_ReceivedEvent(byte0, byte1, byte2) is for all the remaining 3-byte-messages like Note-Ons/-Offs etc…
-channel specific (channel-voice, channel-mode) messages have alway evnt0 < 0xf0
-system messages (sysex, system-common, system-realtime) can be handled in MPROC_Notify_ReceivedByte and have always byte >= 0xf0
use this implementation of MPROC_Notify_ReceivedByte to forward all system-messages to the output:
void MPROC_NotifyReceivedByte(unsigned char byte) __wparam{
//this function forwards all system messages to the output
static unsigned char fx_status = 0;
if(byte >= 0xf0){//system status byte
MIOS_MIDI_TxBufferPut(byte);
//determine status
switch(byte){
case 0xf1://midi timecode
case 0xf3://songselect
fx_status = 1;
break;
case 0xf2://songposition pointer
fx_status = 2;
break;
case 0xf0://sysex, forward until 0xf7
fx_status = 0xff;
break;
default://applies also on 0xf7!
fx_status = 0;
}
}
else if(fx_status){
MIOS_MIDI_TxBufferPut(byte);
if(fx_status!=0xff)
fx_status--;
}
}
the above code is a “pimped” version of the code by TK:
void MPROC_NotifyReceivedByte(unsigned char byte) __wparam
{
static char fx_status;
// normal MIDI events are forwarded in MPROC_NotifyReceivedEvnt
// this function handles sysex and realtime messages
if( byte & 0x80 ) { // Status message
if( byte >= 0xf0 )
MIOS_MIDI_TxBufferPut(byte); // transfer byte
// determine status
if( byte == 0xf0 ) {
fx_status = 0xff; // forward until 0xf7
} else if( byte == 0xf7 ) {
fx_status = 0; // f7 reached, no forward
} else if( byte == 0xf1 || byte == 0xf3 ) {
fx_status = 1; // expecting one additional byte
} else if( byte == 0xf2 ) {
fx_status = 2; // expecting two additional bytes
} else {
fx_status = 0; // expecting no additional byte
}
} else {
// check if fx status active
if( fx_status ) {
// forward data byte
MIOS_MIDI_TxBufferPut(byte);
// decrement counter if required
if( fx_status != 0xff )
--fx_status;
}
}
}
when you want to manipulate / parse the data, replace MIOS_MIDI_TxBufferPut(byte) with your code