2 Copyright (C) 2006 Paul Davis
3 Written by Dave Robillard, 2006
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __ardour_midi_util_h__
22 #define __ardour_midi_util_h__
24 #include <ardour/midi_events.h>
28 /** Return the size of the given event NOT including the status byte,
29 * or -1 if unknown (eg sysex)
32 midi_event_size(unsigned char status)
34 if (status >= 0x80 && status <= 0xE0) {
35 status &= 0xF0; // mask off the channel
39 case MIDI_CMD_NOTE_OFF:
40 case MIDI_CMD_NOTE_ON:
41 case MIDI_CMD_NOTE_PRESSURE:
42 case MIDI_CMD_CONTROL:
44 case MIDI_CMD_COMMON_SONG_POS:
47 case MIDI_CMD_PGM_CHANGE:
48 case MIDI_CMD_CHANNEL_PRESSURE:
49 case MIDI_CMD_COMMON_MTC_QUARTER:
50 case MIDI_CMD_COMMON_SONG_SELECT:
53 case MIDI_CMD_COMMON_TUNE_REQUEST:
54 case MIDI_CMD_COMMON_SYSEX_END:
55 case MIDI_CMD_COMMON_CLOCK:
56 case MIDI_CMD_COMMON_START:
57 case MIDI_CMD_COMMON_CONTINUE:
58 case MIDI_CMD_COMMON_STOP:
59 case MIDI_CMD_COMMON_SENSING:
60 case MIDI_CMD_COMMON_RESET:
63 case MIDI_CMD_COMMON_SYSEX:
72 #endif /* __ardour_midi_util_h__ */