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