00001 #ifndef __CMidiEvent__
00002 #define __CMidiEvent__
00003
00004
00005
00006 #ifdef WIN32
00007 #pragma warning(disable : 4522) //'Exponent::Midi::CMidiEvent' : multiple assignment operators specified
00008 #endif
00009
00010
00011
00012 #include "CMidi.hpp"
00013 #include <Basics/CCountedObject.hpp>
00014
00015
00016
00017 using Exponent::Midi::CMidi;
00018 using Exponent::Basics::CCountedObject;
00019
00020
00021
00022 namespace Exponent
00023 {
00024 namespace Midi
00025 {
00043 class CMidiEvent : public CCountedObject
00044 {
00046 EXPONENT_CLASS_DECLARATION;
00049
00050
00051 public:
00052
00053
00054
00064 CMidiEvent(const long status = CMidi::CMIDI_MIDI_NONE, const long value = 0, const long subValue = 0, const long channel = 1, const long delta = 0);
00065
00070 CMidiEvent(const CMidiEvent &event);
00071
00075 virtual ~CMidiEvent();
00076
00077
00078
00087 static int compareMidiEvents(const CMidiEvent **event1, const CMidiEvent **event2);
00088
00094 bool operator < (const CMidiEvent &event);
00095
00101 bool operator > (const CMidiEvent &event);
00102
00108 bool operator <= (const CMidiEvent &event);
00109
00115 bool operator >= (const CMidiEvent &event);
00116
00122 CMidiEvent &operator = (const CMidiEvent &event);
00123
00130 virtual bool operator == (const CMidiEvent &event);
00131
00138 virtual bool operator != (const CMidiEvent &event);
00139
00140
00141
00146 FORCEINLINE const long getStatus() const { return m_status; }
00147
00152 FORCEINLINE const long getValue() const { return m_value; }
00153
00158 FORCEINLINE const long getSubValue() const { return m_subValue; }
00159
00164 FORCEINLINE const long getChannel() const { return m_channel; }
00165
00170 FORCEINLINE const long getTimeDelta() const { return m_timeDelta; }
00171
00176 FORCEINLINE double getPitchBend() const { return m_pitchBend; }
00177
00178
00179
00184 FORCEINLINE void setStatus(const long status) { m_status = status; }
00185
00190 FORCEINLINE void setValue(const long value) { m_value = value; }
00191
00196 FORCEINLINE void setSubValue(const long value) { m_subValue = value; }
00197
00202 FORCEINLINE void setChannel(const long channel) { m_channel = channel; }
00203
00208 FORCEINLINE void setTimeDelta(const long delta) { m_timeDelta = delta; }
00209
00214 FORCEINLINE void setPitchBend(const double pitchBend) { m_pitchBend = pitchBend; }
00215
00224 FORCEINLINE void setEvent(const long status, const long value, const long subValue, const long channel, const long delta)
00225 {
00226 m_status = status;
00227 m_value = value;
00228 m_subValue = subValue;
00229 m_channel = channel;
00230 m_timeDelta = delta;
00231 }
00232
00233
00234
00240 FORCEINLINE bool isSynchronousWith(const CMidiEvent &event)
00241 {
00242 return (event.m_timeDelta == m_timeDelta);
00243 }
00244
00245
00246
00251 bool isNoteOn() const { return (m_status == CMidi::CMIDI_NOTE_ON && m_subValue != 0); }
00252
00257 bool isNoteOff() const { return ((m_status == CMidi::CMIDI_NOTE_OFF) || (m_status == CMidi::CMIDI_NOTE_ON && m_subValue == 0)); }
00258
00263 bool isAllNotesOff() const { return (m_status == CMidi::CMIDI_ALL_NOTES_OFF); }
00264
00269 bool isControlChange() const { return (m_status == CMidi::CMIDI_CONTROL_CHANGE); }
00270
00275 bool isPitchBend() const { return (m_status == CMidi::CMIDI_PITCH_BEND); }
00276
00277
00278
00284 virtual void getObjectDescription(char *string, const long size) const;
00285
00286
00287
00288 protected:
00289
00290
00291
00292 long m_status;
00293 long m_value;
00294 long m_subValue;
00295 long m_channel;
00296 long m_timeDelta;
00297 double m_pitchBend;
00298 };
00299 }
00300 }
00301 #endif // End of CEvent.hpp