Jump to content

Mios C sysex forwarding example doesn't compile anymore


sneakthief
 Share

Recommended Posts

I updated my toolchain for the first time in a few years to the latest versions - now the midi sysex forwarding routine doesn't compile anymore http://www.ucapps.de/mios_c_forward_chn1.html

This is the error I get:

"main.c:236 warning 94: comparison is always true due to limited range of data type"

In reference to this line:

     if( fx_status != 0xff )

/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when a MIDI byte has been received
/////////////////////////////////////////////////////////////////////////////
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;
    }
  }
}

I even tried starting from scratch with the simple Clockbox v1c and replace the empty "When a MIDI byte has been received" routine and I still get this error.

Link to comment
Share on other sites

Yes, it will work with "unsigned char".

But:

"main.c:236 warning 94: comparison is always true due to limited range of data type"

Is only a warning, the project should be built regardless of this message.

Are there additional messages?

Best Regards, Thorsten.

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...