Subversion Repositories svn.mios

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
163 tk 1
HEADER 3 MIOS C Example
2
 
3
<H3>Filter out every MIDI Event except Bn 07 xx (Volume Controllers)</H3>
4
 
5
<P CLASS=INFO>We want to create a MIDI filter, which only forwards CC#07 (Volume Controllers).</P>
6
 
7
<P CLASS=INFO>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.</P>
8
 
9
<TT><PRE>
10
/////////////////////////////////////////////////////////////////////////////
11
//  This function is called by MIOS when a complete MIDI event has been received
12
/////////////////////////////////////////////////////////////////////////////
13
void MPROC_NotifyReceivedEvnt(
14
  unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam
15
{
16
  // check for CC at any Channel, and forward event on CC#07 (volume)
17
  // for understanding the MIDI coding, please refer to the MIDI spec
18
  // (-> http://www.borg.com/~jglatt/tech/midispec.htm)
19
 
20
  if( (evnt0 & 0xf0) == 0xb0 && evnt1 == 0x07 ) {
21
    // both values are matching, forward complete MIDI event to MIDI Out
22
    MIOS_MIDI_TxBufferPut(evnt0);
23
    MIOS_MIDI_TxBufferPut(evnt1);
24
    MIOS_MIDI_TxBufferPut(evnt2);
25
  }
26
}
27
</PRE></TT>
28
 
29
<P CLASS=INFO>A list of available MIOS function can be found <A HREF="cmios_fun.html">here</A>.</P>
30
 
31
FOOTER