![](/media/cache/profiles/90d89eccfe88456d58a2872a9350f6a9.50x50_q85.jpg)
KAMUI USB MIDI-CV Example
midi_parser.h@0:9ddbc6e0cd90, 2012-05-05 (annotated)
- Committer:
- radiojunkbox
- Date:
- Sat May 05 11:36:56 2012 +0000
- Revision:
- 0:9ddbc6e0cd90
Rev. 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
radiojunkbox | 0:9ddbc6e0cd90 | 1 | //------------------------------------------------------------- |
radiojunkbox | 0:9ddbc6e0cd90 | 2 | // KAMUI MIDI-CV Example |
radiojunkbox | 0:9ddbc6e0cd90 | 3 | // file : midi_parser.h |
radiojunkbox | 0:9ddbc6e0cd90 | 4 | // Copyright (C) 2012 RJB RadioJunkBox |
radiojunkbox | 0:9ddbc6e0cd90 | 5 | // Released under the MIT License: http://mbed.org/license/mit |
radiojunkbox | 0:9ddbc6e0cd90 | 6 | //------------------------------------------------------------- |
radiojunkbox | 0:9ddbc6e0cd90 | 7 | |
radiojunkbox | 0:9ddbc6e0cd90 | 8 | #ifndef MBED_MIDI_PARSER_H |
radiojunkbox | 0:9ddbc6e0cd90 | 9 | #define MBED_MIDI_PARSER_H |
radiojunkbox | 0:9ddbc6e0cd90 | 10 | |
radiojunkbox | 0:9ddbc6e0cd90 | 11 | //------------------------------------------------------------- |
radiojunkbox | 0:9ddbc6e0cd90 | 12 | // Define |
radiojunkbox | 0:9ddbc6e0cd90 | 13 | |
radiojunkbox | 0:9ddbc6e0cd90 | 14 | #define TRUE 1 |
radiojunkbox | 0:9ddbc6e0cd90 | 15 | #define FALSE 0 |
radiojunkbox | 0:9ddbc6e0cd90 | 16 | #define ON 1 |
radiojunkbox | 0:9ddbc6e0cd90 | 17 | #define OFF 0 |
radiojunkbox | 0:9ddbc6e0cd90 | 18 | |
radiojunkbox | 0:9ddbc6e0cd90 | 19 | #define MAX_CH 16 |
radiojunkbox | 0:9ddbc6e0cd90 | 20 | #define MAX_NOTE_CNT 16 |
radiojunkbox | 0:9ddbc6e0cd90 | 21 | |
radiojunkbox | 0:9ddbc6e0cd90 | 22 | // MIDI Massage |
radiojunkbox | 0:9ddbc6e0cd90 | 23 | #define MIDI_NoteOff 0x80 |
radiojunkbox | 0:9ddbc6e0cd90 | 24 | #define MIDI_NoteOn 0x90 |
radiojunkbox | 0:9ddbc6e0cd90 | 25 | #define MIDI_PolykeyPressure 0xA0 |
radiojunkbox | 0:9ddbc6e0cd90 | 26 | #define MIDI_ControlChange 0xB0 |
radiojunkbox | 0:9ddbc6e0cd90 | 27 | #define MIDI_ProgramChange 0xC0 |
radiojunkbox | 0:9ddbc6e0cd90 | 28 | #define MIDI_ChannelPressure 0xD0 |
radiojunkbox | 0:9ddbc6e0cd90 | 29 | #define MIDI_PitchBend 0xE0 |
radiojunkbox | 0:9ddbc6e0cd90 | 30 | |
radiojunkbox | 0:9ddbc6e0cd90 | 31 | #define MIDI_StartSysEx 0xF0 |
radiojunkbox | 0:9ddbc6e0cd90 | 32 | #define MIDI_TuneRequest 0xF6 |
radiojunkbox | 0:9ddbc6e0cd90 | 33 | #define MIDI_EndSysEx 0xF7 |
radiojunkbox | 0:9ddbc6e0cd90 | 34 | |
radiojunkbox | 0:9ddbc6e0cd90 | 35 | #define MIDI_TimingClock 0xF8 |
radiojunkbox | 0:9ddbc6e0cd90 | 36 | #define MIDI_Start 0xFA |
radiojunkbox | 0:9ddbc6e0cd90 | 37 | #define MIDI_Continue 0xFB |
radiojunkbox | 0:9ddbc6e0cd90 | 38 | #define MIDI_Stop 0xFC |
radiojunkbox | 0:9ddbc6e0cd90 | 39 | #define MIDI_ActiveSensing 0xFE |
radiojunkbox | 0:9ddbc6e0cd90 | 40 | #define MIDI_SystemReset 0xFF |
radiojunkbox | 0:9ddbc6e0cd90 | 41 | |
radiojunkbox | 0:9ddbc6e0cd90 | 42 | #define MIDI_CC_Moduration 0x01 |
radiojunkbox | 0:9ddbc6e0cd90 | 43 | #define MIDI_CC_DataEntry 0x06 |
radiojunkbox | 0:9ddbc6e0cd90 | 44 | #define MIDI_CC_RPN_LSB 0x64 |
radiojunkbox | 0:9ddbc6e0cd90 | 45 | #define MIDI_CC_RPN_MSB 0x65 |
radiojunkbox | 0:9ddbc6e0cd90 | 46 | |
radiojunkbox | 0:9ddbc6e0cd90 | 47 | #define MIDI_MM_AllSoundOff 0x78 |
radiojunkbox | 0:9ddbc6e0cd90 | 48 | #define MIDI_MM_ResetAllControl 0x79 |
radiojunkbox | 0:9ddbc6e0cd90 | 49 | #define MIDI_MM_AllNoteOff 0x7B |
radiojunkbox | 0:9ddbc6e0cd90 | 50 | |
radiojunkbox | 0:9ddbc6e0cd90 | 51 | //------------------------------------------------------------- |
radiojunkbox | 0:9ddbc6e0cd90 | 52 | // Global variables |
radiojunkbox | 0:9ddbc6e0cd90 | 53 | |
radiojunkbox | 0:9ddbc6e0cd90 | 54 | unsigned char gPlayNoteBuf[MAX_CH]; |
radiojunkbox | 0:9ddbc6e0cd90 | 55 | unsigned char gGateBuf[MAX_CH]; |
radiojunkbox | 0:9ddbc6e0cd90 | 56 | unsigned char gPitchBendBuf[MAX_CH]; |
radiojunkbox | 0:9ddbc6e0cd90 | 57 | unsigned char gModWheelBuf[MAX_CH]; |
radiojunkbox | 0:9ddbc6e0cd90 | 58 | unsigned char gMIDISYNC_CLK; |
radiojunkbox | 0:9ddbc6e0cd90 | 59 | unsigned char gMIDISYNC_RUN; |
radiojunkbox | 0:9ddbc6e0cd90 | 60 | |
radiojunkbox | 0:9ddbc6e0cd90 | 61 | unsigned char NoteCnt[MAX_CH]; |
radiojunkbox | 0:9ddbc6e0cd90 | 62 | unsigned char NoteBuf[MAX_CH][MAX_NOTE_CNT]; |
radiojunkbox | 0:9ddbc6e0cd90 | 63 | |
radiojunkbox | 0:9ddbc6e0cd90 | 64 | unsigned char RxByte; |
radiojunkbox | 0:9ddbc6e0cd90 | 65 | unsigned char SysEx; |
radiojunkbox | 0:9ddbc6e0cd90 | 66 | unsigned char MidiCh; |
radiojunkbox | 0:9ddbc6e0cd90 | 67 | unsigned char PC; |
radiojunkbox | 0:9ddbc6e0cd90 | 68 | unsigned char MByte[2]; |
radiojunkbox | 0:9ddbc6e0cd90 | 69 | |
radiojunkbox | 0:9ddbc6e0cd90 | 70 | //------------------------------------------------------------- |
radiojunkbox | 0:9ddbc6e0cd90 | 71 | // Functions |
radiojunkbox | 0:9ddbc6e0cd90 | 72 | |
radiojunkbox | 0:9ddbc6e0cd90 | 73 | void MIDI_Parser(unsigned char); |
radiojunkbox | 0:9ddbc6e0cd90 | 74 | int MIDI_SystemMessage(void); |
radiojunkbox | 0:9ddbc6e0cd90 | 75 | void MIDI_SystemRealtimeMessage(void); |
radiojunkbox | 0:9ddbc6e0cd90 | 76 | void MIDI_ChannelMessage(void); |
radiojunkbox | 0:9ddbc6e0cd90 | 77 | void NoteON(void); |
radiojunkbox | 0:9ddbc6e0cd90 | 78 | void NoteOFF(void); |
radiojunkbox | 0:9ddbc6e0cd90 | 79 | |
radiojunkbox | 0:9ddbc6e0cd90 | 80 | #endif |