Merge branch 'master' into cairocanvas
[ardour.git] / libs / midi++2 / midi++ / types.h
1 /*
2     Copyright (C) 2000-2007 Paul Davis 
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
20 #ifndef __midi_types_h__
21 #define __midi_types_h__
22
23 #include <jack/jack.h>
24 #include <inttypes.h>
25
26 namespace MIDI {
27
28         typedef char           channel_t;
29         typedef float          controller_value_t;
30         typedef unsigned char  byte;
31         typedef unsigned short pitchbend_t;
32         typedef uint32_t       timestamp_t;
33
34         /** XXX: dupes from libardour */
35         typedef int64_t        framecnt_t;
36         typedef jack_nframes_t pframes_t;
37
38         enum eventType {
39             none = 0x0,
40             raw = 0xF4, /* undefined in MIDI spec */
41             any = 0xF5, /* undefined in MIDI spec */
42             off = 0x80,
43             on = 0x90,
44             controller = 0xB0,
45             program = 0xC0,
46             chanpress = 0xD0,
47             polypress = 0xA0,
48             pitchbend = 0xE0,
49             sysex = 0xF0,
50             mtc_quarter = 0xF1,
51             position = 0xF2,
52             song = 0xF3,
53             tune = 0xF6,
54             eox = 0xF7,
55             timing = 0xF8,
56             start = 0xFA,
57             contineu = 0xFB, /* note spelling */
58             stop = 0xFC,
59             active = 0xFE,
60             reset = 0xFF
61     };
62
63     extern const char *controller_names[];
64         byte decode_controller_name (const char *name);
65
66     struct EventTwoBytes {
67         union {
68             byte note_number;
69             byte controller_number;
70         };
71         union {
72             byte velocity;
73             byte value;
74         };
75     };
76
77     enum MTC_FPS {
78             MTC_24_FPS = 0,
79             MTC_25_FPS = 1,
80             MTC_30_FPS_DROP = 2,
81             MTC_30_FPS = 3
82     };
83
84     enum MTC_Status {
85             MTC_Stopped = 0,
86             MTC_Forward,
87             MTC_Backward
88     };
89
90 } // namespace MIDI
91
92 #endif // __midi_types_h__
93
94
95
96