1 /* This file is part of Evoral.
2 * Copyright(C) 2008 Dave Robillard <http://drobilla.net>
3 * Copyright(C) 2000-2008 Paul Davis
5 * Evoral is free software; you can redistribute it and/or modify it under the
6 * terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or(at your option) any later
10 * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef EVORAL_MIDI_UTIL_H
20 #define EVORAL_MIDI_UTIL_H
22 #include <evoral/midi_events.h>
26 /** Return the size of the given event NOT including the status byte,
27 * or -1 if unknown (eg sysex)
30 midi_event_size(unsigned char status)
32 // if we have a channel event
33 if (status >= 0x80 && status < 0xF0) {
34 status &= 0xF0; // mask off the channel
38 case MIDI_CMD_NOTE_OFF:
39 case MIDI_CMD_NOTE_ON:
40 case MIDI_CMD_NOTE_PRESSURE:
41 case MIDI_CMD_CONTROL:
43 case MIDI_CMD_COMMON_SONG_POS:
46 case MIDI_CMD_PGM_CHANGE:
47 case MIDI_CMD_CHANNEL_PRESSURE:
48 case MIDI_CMD_COMMON_MTC_QUARTER:
49 case MIDI_CMD_COMMON_SONG_SELECT:
52 case MIDI_CMD_COMMON_TUNE_REQUEST:
53 case MIDI_CMD_COMMON_SYSEX_END:
54 case MIDI_CMD_COMMON_CLOCK:
55 case MIDI_CMD_COMMON_START:
56 case MIDI_CMD_COMMON_CONTINUE:
57 case MIDI_CMD_COMMON_STOP:
58 case MIDI_CMD_COMMON_SENSING:
59 case MIDI_CMD_COMMON_RESET:
62 case MIDI_CMD_COMMON_SYSEX:
71 #endif // EVORAL_MIDI_UTIL_H