MuseScore  3.4
Music composition and notation
midievent.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseSynth
3 // Music Software Synthesizer
4 //
5 // Copyright (C) 2013 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __MIDIEVENT_H__
14 #define __MIDIEVENT_H__
15 
16 //---------------------------------------------------------
17 // MidiEventType
18 //---------------------------------------------------------
19 
20 enum class MidiEventType : unsigned char {
21  NOTEOFF = 0x80,
22  NOTEON = 0x90,
23  POLYAFTER = 0xa0,
24  CONTROLLER = 0xb0,
25  PROGRAM = 0xc0,
26  AFTERTOUCH = 0xd0,
27  PITCHBEND = 0xe0,
28  META = 0xff,
29  SYSEX = 0xf0,
30  SONGPOS = 0xf2,
31  ENDSYSEX = 0xf7,
32  CLOCK = 0xf8,
33  START = 0xfa,
34  CONTINUE = 0xfb,
35  STOP = 0xfc,
36  SENSE = 0xfe // active sense (used by yamaha)
37  };
38 
39 enum {
40  CTRL_HBANK = 0x00,
41  CTRL_LBANK = 0x20,
42 
43  CTRL_HDATA = 0x06,
44  CTRL_LDATA = 0x26,
45 
46  CTRL_HNRPN = 0x63,
47  CTRL_LNRPN = 0x62,
48 
49  CTRL_HRPN = 0x65,
50  CTRL_LRPN = 0x64,
51 
53  CTRL_BREATH = 0x02,
54  CTRL_FOOT = 0x04,
56  CTRL_VOLUME = 0x07,
57  CTRL_PANPOT = 0x0a,
59  CTRL_SUSTAIN = 0x40,
66 
72 
73  CTRL_ALL_SOUNDS_OFF = 0x78, // 120
74  CTRL_RESET_ALL_CTRL = 0x79, // 121
75  CTRL_LOCAL_OFF = 0x7a, // 122
76  CTRL_ALL_NOTES_OFF = 0x7b // 123
77  };
78 
79 //---------------------------------------------------------
80 // Midi Meta Events
81 //---------------------------------------------------------
82 
83 enum {
85  META_TEXT = 1,
92  META_PROGRAM_NAME = 8, // MIDI Meta Events 8 and 9 were defined as above by the MMA in 1998
93  META_DEVICE_NAME = 9, // It is therefore necessary to redefine MuseScore's private meta events
94  META_TRACK_COMMENT = 0xf, // Using the block starting 0x10 seems sensible as that is currently clear
95  META_TITLE = 0x10, // mscore extension
96  META_SUBTITLE = 0x11, // mscore extension
97  META_COMPOSER = 0x12, // mscore extension
98  META_TRANSLATOR = 0x13, // mscore extension
99  META_POET = 0x14, // mscore extension
102  META_EOT = 0x2f, // end of track
103  META_TEMPO = 0x51,
106  };
107 
108 //---------------------------------------------------------
109 // MidiEvent
110 //---------------------------------------------------------
111 
112 class MidiEvent {
114  char _channel;
115  char _dataA;
116  char _dataB;
117 
118  public:
120  MidiEvent(MidiEventType t, char c, char a, char b)
121  : _type(t), _channel(c), _dataA(a), _dataB(b) {};
122  void set(MidiEventType t, char c, char a, char b) {
123  _type = t;
124  _channel = c;
125  _dataA = a;
126  _dataB = b;
127  }
128 
129  MidiEventType type() const { return _type; }
130  void setType(MidiEventType t) { _type = t; }
131  char channel() const { return _channel; }
132  char dataA() const { return _dataA; }
133  char dataB() const { return _dataB; }
134  };
135 
136 #endif
137 
char dataA() const
Definition: midievent.h:132
Definition: midievent.h:86
char _dataB
Definition: midievent.h:116
Definition: midievent.h:99
MidiEvent(MidiEventType t, char c, char a, char b)
Definition: midievent.h:120
Definition: midievent.h:52
Definition: midievent.h:105
Definition: midievent.h:89
Definition: midievent.h:69
Definition: midievent.h:64
Definition: midievent.h:57
Definition: midievent.h:76
Definition: midievent.h:73
Definition: midievent.h:88
MidiEventType _type
Definition: midievent.h:113
Definition: midievent.h:95
char _dataA
Definition: midievent.h:115
MidiEventType type() const
Definition: midievent.h:129
Definition: midievent.h:68
Definition: midievent.h:74
Definition: midievent.h:112
Definition: midievent.h:104
Definition: midievent.h:60
Definition: midievent.h:85
Definition: midievent.h:96
Definition: midievent.h:98
Definition: midievent.h:67
Definition: midievent.h:47
char _channel
Definition: midievent.h:114
Definition: midievent.h:93
char dataB() const
Definition: midievent.h:133
Definition: midievent.h:40
Definition: midievent.h:101
Definition: midievent.h:59
Definition: midievent.h:53
Definition: midievent.h:94
Definition: midievent.h:91
Definition: midievent.h:46
Definition: midievent.h:90
Definition: midievent.h:65
Definition: midievent.h:55
Definition: midievent.h:100
char channel() const
Definition: midievent.h:131
Definition: midievent.h:58
Definition: midievent.h:49
Definition: midievent.h:56
Definition: midievent.h:92
Definition: midievent.h:84
MidiEventType
Definition: midievent.h:20
Definition: midievent.h:75
Definition: midievent.h:62
Definition: midievent.h:50
Definition: midievent.h:70
Definition: midievent.h:103
MidiEvent()
Definition: midievent.h:119
Definition: midievent.h:43
Definition: midievent.h:97
Definition: midievent.h:102
Definition: midievent.h:87
Definition: midievent.h:71
Definition: midievent.h:61
Definition: midievent.h:44
Definition: midievent.h:41
Definition: midievent.h:63
void setType(MidiEventType t)
Definition: midievent.h:130
Definition: midievent.h:54