Filter out every MIDI Event except Bn 07 xx (Volume Controllers)

We want to create a MIDI filter, which only forwards CC#07 (Volume Controllers).

Copy the SDCC skeleton into a new directory, open the main.c file and enhance the hooks like described below. Thereafter type "make" in the command shell, and upload the new project.hex file to the core.

/////////////////////////////////////////////////////////////////////////////
//  This function is called by MIOS when a complete MIDI event has been received
/////////////////////////////////////////////////////////////////////////////
void MPROC_NotifyReceivedEvnt(
  unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam
{
  // check for CC at any Channel, and forward event on CC#07 (volume)
  // for understanding the MIDI coding, please refer to the MIDI spec 
  // (-> http://www.borg.com/~jglatt/tech/midispec.htm)

  if( (evnt0 & 0xf0) == 0xb0 && evnt1 == 0x07 ) {
    // both values are matching, forward complete MIDI event to MIDI Out
    MIOS_MIDI_TxBufferPut(evnt0);
    MIOS_MIDI_TxBufferPut(evnt1);
    MIOS_MIDI_TxBufferPut(evnt2);
  }
}

A list of available MIOS function can be found here.



Last update: 2018-01-06

Copyright 1998-2018, Thorsten Klose. All rights reserved.