A class that converts byte streams into MIDI messages, and stores them in a FIFO. This is useful if you wish to read MIDI messages via polling instead of interrupts. The class supports every type of MIDI message, and System Realtime messages can be interleaved with regular ones.
Revision 1:1c3f0c6ea0fb, committed 2016-08-04
- Comitter:
- Padman
- Date:
- Thu Aug 04 12:02:12 2016 +0000
- Parent:
- 0:69cbdcd5d770
- Child:
- 2:cbd43ba7f842
- Commit message:
- Added API documentation
Changed in this revision
MIDIparser.cpp | Show annotated file Show diff for this revision Revisions of this file |
MIDIparser.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MIDIparser.cpp Wed Aug 03 16:22:22 2016 +0000 +++ b/MIDIparser.cpp Thu Aug 04 12:02:12 2016 +0000 @@ -133,7 +133,7 @@ } } -bool MIDIparser::available() { return !output_queue.empty(); } +uint32_t MIDIparser::available() { return !output_queue.empty(); } MIDIMessage MIDIparser::grab() {
--- a/MIDIparser.h Wed Aug 03 16:22:22 2016 +0000 +++ b/MIDIparser.h Thu Aug 04 12:02:12 2016 +0000 @@ -70,9 +70,20 @@ public: MIDIparser(); - - void parse(uint8_t); - bool available(); + + /** Input a byte to the parser + * @param data The byte to parse + */ + void parse(uint8_t data); + + /** Determine if a MIDI message is in the queue + * @return 1 if something is ready, 0 otherwise + */ + uint32_t available(); + + /** Grab the next MIDI message + * @return The next MIDI message + */ MIDIMessage grab(); };