summaryrefslogtreecommitdiff
path: root/libs/midi++2/midi++/types.h
blob: c29ce1c767bb73b06bd68298a769b4d6fb415283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
    Copyright (C) 2000-2007 Paul Davis

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef __midi_types_h__
#define __midi_types_h__

#include <inttypes.h>

#include "midi++/libmidi_visibility.h"

namespace MIDI {

	typedef char           channel_t;
	typedef float          controller_value_t;
	typedef unsigned char  byte;
	typedef unsigned short pitchbend_t;
	typedef uint32_t       timestamp_t;

	/** XXX: dupes from libardour */
	typedef int64_t  framecnt_t;
	typedef uint32_t pframes_t;

	enum eventType {
	    none = 0x0,
	    raw = 0xF4, /* undefined in MIDI spec */
	    any = 0xF5, /* undefined in MIDI spec */
	    off = 0x80,
	    on = 0x90,
	    controller = 0xB0,
	    program = 0xC0,
	    chanpress = 0xD0,
	    polypress = 0xA0,
	    pitchbend = 0xE0,
	    sysex = 0xF0,
	    mtc_quarter = 0xF1,
	    position = 0xF2,
	    song = 0xF3,
	    tune = 0xF6,
	    eox = 0xF7,
	    timing = 0xF8,
	    start = 0xFA,
	    contineu = 0xFB, /* note spelling */
	    stop = 0xFC,
	    active = 0xFE,
	    reset = 0xFF
    };

    LIBMIDIPP_API extern const char *controller_names[];
	byte decode_controller_name (const char *name);

    struct LIBMIDIPP_API EventTwoBytes {
	union {
	    byte note_number;
	    byte controller_number;
	};
	union {
	    byte velocity;
	    byte value;
	};
    };

    enum LIBMIDIPP_API MTC_FPS {
	    MTC_24_FPS = 0,
	    MTC_25_FPS = 1,
	    MTC_30_FPS_DROP = 2,
	    MTC_30_FPS = 3
    };

    enum LIBMIDIPP_API MTC_Status {
	    MTC_Stopped = 0,
	    MTC_Forward,
	    MTC_Backward
    };

} // namespace MIDI

#endif // __midi_types_h__