Mercurial > hg > svcore
comparison data/midi/MIDIEvent.h @ 1038:cc27f35aa75c cxx11
Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author | Chris Cannam |
---|---|
date | Tue, 03 Mar 2015 15:18:24 +0000 |
parents | 06f13a3b9e9e |
children | 48e9f538e6e9 |
comparison
equal
deleted
inserted
replaced
1037:bf0e5944289b | 1038:cc27f35aa75c |
---|---|
23 #define _MIDI_EVENT_H_ | 23 #define _MIDI_EVENT_H_ |
24 | 24 |
25 #include <QString> | 25 #include <QString> |
26 #include <string> | 26 #include <string> |
27 #include <iostream> | 27 #include <iostream> |
28 #include <stdexcept> | |
29 | |
28 #include "base/Debug.h" | 30 #include "base/Debug.h" |
29 | 31 |
30 typedef unsigned char MIDIByte; | 32 typedef unsigned char MIDIByte; |
31 | 33 |
32 namespace MIDIConstants | 34 namespace MIDIConstants |
116 | 118 |
117 class MIDIEvent | 119 class MIDIEvent |
118 { | 120 { |
119 public: | 121 public: |
120 MIDIEvent(unsigned long deltaTime, | 122 MIDIEvent(unsigned long deltaTime, |
121 MIDIByte eventCode, | 123 int eventCode, |
122 MIDIByte data1 = 0, | 124 int data1 = 0, |
123 MIDIByte data2 = 0) : | 125 int data2 = 0) : |
124 m_deltaTime(deltaTime), | 126 m_deltaTime(deltaTime), |
125 m_duration(0), | 127 m_duration(0), |
126 m_eventCode(eventCode), | |
127 m_data1(data1), | |
128 m_data2(data2), | |
129 m_metaEventCode(0) | 128 m_metaEventCode(0) |
130 { } | 129 { |
130 if (eventCode < 0 || eventCode > 0xff || | |
131 data1 < 0 || data1 > 0xff || | |
132 data2 < 0 || data2 > 0xff) { | |
133 throw std::domain_error("not all args within byte range"); | |
134 } | |
135 m_eventCode = MIDIByte(eventCode); | |
136 m_data1 = MIDIByte(data1); | |
137 m_data2 = MIDIByte(data2); | |
138 } | |
131 | 139 |
132 MIDIEvent(unsigned long deltaTime, | 140 MIDIEvent(unsigned long deltaTime, |
133 MIDIByte eventCode, | 141 MIDIByte eventCode, |
134 MIDIByte metaEventCode, | 142 MIDIByte metaEventCode, |
135 const std::string &metaMessage) : | 143 const std::string &metaMessage) : |