remove debug output
[ardour.git] / libs / backends / portaudio / midi_util.cc
1 /*
2  * Copyright (C) 2015 Tim Mayberry <mojofunk@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18
19 #include "midi_util.h"
20
21 int get_midi_msg_length (uint8_t status_byte)
22 {
23         // define these with meaningful names
24         switch (status_byte & 0xf0) {
25         case 0x80:
26         case 0x90:
27         case 0xa0:
28         case 0xb0:
29         case 0xe0:
30                 return 3;
31         case 0xc0:
32         case 0xd0:
33                 return 2;
34         case 0xf0:
35                 switch (status_byte) {
36                 case 0xf0:
37                         return 0;
38                 case 0xf1:
39                 case 0xf3:
40                         return 2;
41                 case 0xf2:
42                         return 3;
43                 case 0xf4:
44                 case 0xf5:
45                 case 0xf7:
46                 case 0xfd:
47                         break;
48                 default:
49                         return 1;
50                 }
51         }
52         return -1;
53 }