1 //=========================================================
2 //  MusE
3 //  Linux Music Editor
4 //  midi_consts.h
5 //
6 //  (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
7 //  (C) Copyright 2011-2016 Tim E. Real (terminator356 on users dot sourceforge dot net)
8 //
9 //  This program is free software; you can redistribute it and/or
10 //  modify it under the terms of the GNU General Public License
11 //  as published by the Free Software Foundation; version 2 of
12 //  the License, or (at your option) any later version.
13 //
14 //  This program is distributed in the hope that it will be useful,
15 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 //  GNU General Public License for more details.
18 //
19 //  You should have received a copy of the GNU General Public License
20 //  along with this program; if not, write to the Free Software
21 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22 //
23 //=========================================================
24 
25 #ifndef __MIDI_CONSTS_H__
26 #define __MIDI_CONSTS_H__
27 
28 namespace MusECore {
29 
30 enum {
31       ME_NOTEOFF     = 0x80,
32       ME_NOTEON      = 0x90,
33       ME_POLYAFTER   = 0xa0,
34       ME_CONTROLLER  = 0xb0,
35       ME_PROGRAM     = 0xc0,
36       ME_AFTERTOUCH  = 0xd0,
37       ME_PITCHBEND   = 0xe0,
38       ME_SYSEX       = 0xf0,
39       ME_META        = 0xff,
40       ME_MTC_QUARTER = 0xf1,
41       ME_SONGPOS     = 0xf2,
42       ME_SONGSEL     = 0xf3,
43       ME_TUNE_REQ    = 0xf6,
44       ME_SYSEX_END   = 0xf7,
45       ME_CLOCK       = 0xf8,
46       ME_TICK        = 0xf9,
47       ME_START       = 0xfa,
48       ME_CONTINUE    = 0xfb,
49       ME_STOP        = 0xfc,
50       ME_SENSE       = 0xfe,
51       ME_RESET       = 0xff
52       };
53 
54 //--------------------------------------
55 // Recognized / transmitted  meta events:
56 //--------------------------------------
57 enum {
58       ME_META_TEXT_0_SEQUENCE_NUMBER = 0x00,
59       ME_META_TEXT_1_COMMENT = 0x01,
60       ME_META_TEXT_2_COPYRIGHT = 0x02,
61       ME_META_TEXT_3_TRACK_NAME = 0x03,
62       ME_META_TEXT_4_INSTRUMENT_NAME = 0x04,
63       ME_META_TEXT_5_LYRIC = 0x05,
64       ME_META_TEXT_6_MARKER = 0x06,
65       ME_META_TEXT_7_CUE_POINT = 0x07,
66       ME_META_TEXT_8_PROGRAM_NAME = 0x08,
67       ME_META_TEXT_9_DEVICE_NAME = 0x09,
68       ME_META_TEXT_A = 0x0a,
69       ME_META_TEXT_B = 0x0b,
70       ME_META_TEXT_C = 0x0c,
71       ME_META_TEXT_D = 0x0d,
72       ME_META_TEXT_E = 0x0e,
73       ME_META_TEXT_F_TRACK_COMMENT = 0x0f,
74       ME_META_CHANNEL_CHANGE = 0x20,
75       ME_META_PORT_CHANGE = 0x21,
76       ME_META_END_OF_TRACK = 0x2f,
77       ME_META_SET_TEMPO = 0x51,
78       ME_META_SMPTE_OFFSET = 0x54,
79       ME_META_TIME_SIGNATURE = 0x58,
80       ME_META_KEY_SIGNATURE = 0x59,
81       ME_META_SEQ_SPECIFIC_1 = 0x74,
82       ME_META_SEQ_SPECIFIC_2 = 0x7f
83 };
84 
85 enum AudioTickSound {
86     beatSound,
87     measureSound,
88     accent1Sound,
89     accent2Sound
90 };
91 
92 const unsigned char gmOnMsg[]   = { 0x7e, 0x7f, 0x09, 0x01 };
93 const unsigned char gm2OnMsg[]  = { 0x7e, 0x7f, 0x09, 0x03 };
94 const unsigned char gmOffMsg[]  = { 0x7e, 0x7f, 0x09, 0x02 };
95 const unsigned char gsOnMsg[]   = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7f, 0x00, 0x41 };
96 const unsigned char gsOnMsg2[]  = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x33, 0x50, 0x3c };
97 const unsigned char gsOnMsg3[]  = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x34, 0x50, 0x3b };
98 const unsigned char xgOnMsg[]   = { 0x43, 0x10, 0x4c, 0x00, 0x00, 0x7e, 0x00 };
99 const unsigned int  gmOnMsgLen  = sizeof(gmOnMsg);
100 const unsigned int  gm2OnMsgLen = sizeof(gm2OnMsg);
101 const unsigned int  gmOffMsgLen = sizeof(gmOffMsg);
102 const unsigned int  gsOnMsgLen  = sizeof(gsOnMsg);
103 const unsigned int  gsOnMsg2Len = sizeof(gsOnMsg2);
104 const unsigned int  gsOnMsg3Len = sizeof(gsOnMsg3);
105 const unsigned int  xgOnMsgLen  = sizeof(xgOnMsg);
106 
107 const unsigned char mmcDeferredPlayMsg[] = { 0x7f, 0x7f, 0x06, 0x03 };
108 const unsigned char mmcStopMsg[] =         { 0x7f, 0x7f, 0x06, 0x01 };
109 const unsigned char mmcLocateMsg[] =       { 0x7f, 0x7f, 0x06, 0x44, 0x06, 0x01, 0, 0, 0, 0, 0 };
110 
111 const unsigned int  mmcDeferredPlayMsgLen = sizeof(mmcDeferredPlayMsg);
112 const unsigned int  mmcStopMsgLen = sizeof(mmcStopMsg);
113 const unsigned int  mmcLocateMsgLen = sizeof(mmcLocateMsg);
114 
115 // Use these in all the synths and their guis.
116 // NOTE: Some synths and hosts might not use this scheme. For example, MESS requires it for IPC,
117 //        and both MESS and DSSI use it to store init data in the form of a sysex.
118 //
119 // Added this here for ease, since they all include this file.
120 //
121 // A special MusE soft synth sysex manufacturer ID.
122 #define MUSE_SYNTH_SYSEX_MFG_ID 0x7c
123 // Following the MFG_ID, besides synth specific IDs, this reserved special ID indicates
124 //  a MusE SYSTEM ID will follow in the next byte.
125 #define MUSE_SYSEX_SYSTEM_ID 0x7f
126 // This SYSTEM command will force any relevant drum maps to update.
127 // When a synth's note names have changed, it should issue this command.
128 // So far, this command is really just a special requirement for the fluidsynth MESS plugin.
129 // It is the only way to inform the host to update the maps.
130 #define MUSE_SYSEX_SYSTEM_UPDATE_DRUM_MAPS_ID 0x00
131 
132 } // namespace MusECore
133 
134 #endif
135 
136 
137