Radio Junk Box / Mbed 2 deprecated KAMUI_MIDI-CV_Example

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers midi_parser.h Source File

midi_parser.h

00001 //-------------------------------------------------------------
00002 // KAMUI MIDI-CV Example
00003 // file : midi_parser.h
00004 // Copyright (C) 2012 RJB RadioJunkBox
00005 // Released under the MIT License: http://mbed.org/license/mit
00006 //-------------------------------------------------------------
00007 
00008 #ifndef MBED_MIDI_PARSER_H
00009 #define MBED_MIDI_PARSER_H
00010 
00011 //-------------------------------------------------------------
00012 // Define
00013 
00014 #define TRUE                    1
00015 #define FALSE                   0
00016 #define ON                      1
00017 #define OFF                     0
00018 
00019 #define MAX_CH                  16
00020 #define MAX_NOTE_CNT            16
00021 
00022 // MIDI Massage
00023 #define MIDI_NoteOff            0x80
00024 #define MIDI_NoteOn             0x90
00025 #define MIDI_PolykeyPressure    0xA0
00026 #define MIDI_ControlChange      0xB0
00027 #define MIDI_ProgramChange      0xC0
00028 #define MIDI_ChannelPressure    0xD0
00029 #define MIDI_PitchBend          0xE0
00030 
00031 #define MIDI_StartSysEx         0xF0
00032 #define MIDI_TuneRequest        0xF6
00033 #define MIDI_EndSysEx           0xF7
00034 
00035 #define MIDI_TimingClock        0xF8
00036 #define MIDI_Start              0xFA
00037 #define MIDI_Continue           0xFB
00038 #define MIDI_Stop               0xFC
00039 #define MIDI_ActiveSensing      0xFE
00040 #define MIDI_SystemReset        0xFF
00041 
00042 #define MIDI_CC_Moduration      0x01
00043 #define MIDI_CC_DataEntry       0x06
00044 #define MIDI_CC_RPN_LSB         0x64
00045 #define MIDI_CC_RPN_MSB         0x65
00046 
00047 #define MIDI_MM_AllSoundOff     0x78
00048 #define MIDI_MM_ResetAllControl 0x79
00049 #define MIDI_MM_AllNoteOff      0x7B
00050 
00051 //-------------------------------------------------------------
00052 // Global variables
00053 
00054 unsigned char    gPlayNoteBuf[MAX_CH];
00055 unsigned char    gGateBuf[MAX_CH];
00056 unsigned char    gPitchBendBuf[MAX_CH];
00057 unsigned char    gModWheelBuf[MAX_CH];
00058 unsigned char    gMIDISYNC_CLK;
00059 unsigned char    gMIDISYNC_RUN;
00060 
00061 unsigned char    NoteCnt[MAX_CH];
00062 unsigned char    NoteBuf[MAX_CH][MAX_NOTE_CNT];
00063 
00064 unsigned char    RxByte;
00065 unsigned char    SysEx;
00066 unsigned char    MidiCh;
00067 unsigned char    PC;
00068 unsigned char    MByte[2];
00069 
00070 //-------------------------------------------------------------
00071 // Functions
00072 
00073 void MIDI_Parser(unsigned char);
00074 int  MIDI_SystemMessage(void);
00075 void MIDI_SystemRealtimeMessage(void);
00076 void MIDI_ChannelMessage(void);
00077 void NoteON(void);
00078 void NoteOFF(void);
00079 
00080 #endif