2 * Copyright (C) 2014,2017 Robin Gareus <robin@gareus.org>
3 * Copyright (C) 2010 Devin Anderson
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "ardour/raw_midi_parser.h"
22 using namespace ARDOUR;
24 RawMidiParser::RawMidiParser ()
29 /* based on AlsaRawMidiIn, some code-dup */
31 RawMidiParser::process_byte (const uint8_t byte)
38 prepare_byte_event (byte);
43 if (_status_byte == 0xf0) {
45 return prepare_buffered_event ();
48 _unbuffered_bytes = 0;
54 // Non-realtime status byte
57 _unbuffered_bytes = 0;
60 switch (byte & 0xf0) {
66 // Note On, Note Off, Aftertouch, Control Change, Pitch Wheel
71 // Program Change, Channel Pressure
82 // MTC Quarter Frame, Song Select
97 prepare_byte_event (byte);
108 // Data bytes without a status will be discarded.
114 record_byte (_status_byte);
117 return (_total_bytes == _expected_bytes) ? prepare_buffered_event () : false;