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 <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 we have a channel event
35 if (status >= 0x80 && status < 0xF0) {
36 status &= 0xF0; // mask off the channel
40 case MIDI_CMD_NOTE_OFF:
41 case MIDI_CMD_NOTE_ON:
42 case MIDI_CMD_NOTE_PRESSURE:
43 case MIDI_CMD_CONTROL:
45 case MIDI_CMD_COMMON_SONG_POS:
48 case MIDI_CMD_PGM_CHANGE:
49 case MIDI_CMD_CHANNEL_PRESSURE:
50 case MIDI_CMD_COMMON_MTC_QUARTER:
51 case MIDI_CMD_COMMON_SONG_SELECT:
54 case MIDI_CMD_COMMON_TUNE_REQUEST:
55 case MIDI_CMD_COMMON_SYSEX_END:
56 case MIDI_CMD_COMMON_CLOCK:
57 case MIDI_CMD_COMMON_START:
58 case MIDI_CMD_COMMON_CONTINUE:
59 case MIDI_CMD_COMMON_STOP:
60 case MIDI_CMD_COMMON_SENSING:
61 case MIDI_CMD_COMMON_RESET:
64 case MIDI_CMD_COMMON_SYSEX:
73 #endif /* __ardour_midi_util_h__ */