1 /*
2  * Copyright (C) 2000-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2006-2007 David Robillard <d@drobilla.net>
4  *
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.
9  *
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.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __midi_types_h__
21 #define __midi_types_h__
22 
23 #include <inttypes.h>
24 
25 #include "midi++/libmidi_visibility.h"
26 
27 namespace MIDI {
28 
29 	typedef char           channel_t;
30 	typedef float          controller_value_t;
31 	typedef unsigned char  byte;
32 	typedef unsigned short pitchbend_t;
33 	typedef uint32_t       timestamp_t;
34 
35 	/** XXX: dupes from libardour */
36 	typedef int64_t  samplecnt_t;
37 	typedef uint32_t pframes_t;
38 
39 	enum eventType {
40 	    none = 0x0,
41 	    raw = 0xF4, /* undefined in MIDI spec */
42 	    any = 0xF5, /* undefined in MIDI spec */
43 	    off = 0x80,
44 	    on = 0x90,
45 	    controller = 0xB0,
46 	    program = 0xC0,
47 	    chanpress = 0xD0,
48 	    polypress = 0xA0,
49 	    pitchbend = 0xE0,
50 	    sysex = 0xF0,
51 	    mtc_quarter = 0xF1,
52 	    position = 0xF2,
53 	    song = 0xF3,
54 	    tune = 0xF6,
55 	    eox = 0xF7,
56 	    timing = 0xF8,
57 	    start = 0xFA,
58 	    contineu = 0xFB, /* note spelling */
59 	    stop = 0xFC,
60 	    active = 0xFE,
61 	    reset = 0xFF
62     };
63 
64     LIBMIDIPP_API extern const char *controller_names[];
65 	byte decode_controller_name (const char *name);
66 
67     struct LIBMIDIPP_API EventTwoBytes {
68 	union {
69 	    byte note_number;
70 	    byte controller_number;
71 	};
72 	union {
73 	    byte velocity;
74 	    byte value;
75 	};
76     };
77 
78     enum LIBMIDIPP_API MTC_FPS {
79 	    MTC_24_FPS = 0,
80 	    MTC_25_FPS = 1,
81 	    MTC_30_FPS_DROP = 2,
82 	    MTC_30_FPS = 3
83     };
84 
85     enum LIBMIDIPP_API MTC_Status {
86 	    MTC_Stopped = 0,
87 	    MTC_Forward,
88 	    MTC_Backward
89     };
90 
91 } // namespace MIDI
92 
93 #endif // __midi_types_h__
94 
95 
96 
97 
98