- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::Midi::CMidiEvent Class Reference

Inheritance diagram for Exponent::Midi::CMidiEvent:

List of all members.

## Detailed Description

Wrapper class around a midi event.

Date:
  29/08/2004

Author:
  Paul Chana

Version:
  1.0.0 Initial version

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  CMidiEvent.hpp,v 1.7 2007/02/08 21:08:09 paul Exp

Definition at line 43 of file CMidiEvent.hpp.

## Public Member Functions

- CMidiEvent (const CMidiEvent &event)
- CMidiEvent (const long status=CMidi::CMIDI_MIDI_NONE, const long value=0, const long subValue=0, const long channel=1, const long delta=0)
- FORCEINLINE const long getChannel () const
- virtual void getObjectDescription (char *string, const long size) const
- FORCEINLINE double getPitchBend () const
- FORCEINLINE const long getStatus () const
- FORCEINLINE const long getSubValue () const
- FORCEINLINE const long getTimeDelta () const
- FORCEINLINE const long getValue () const
- bool isAllNotesOff () const
- bool isControlChange () const
- bool isNoteOff () const
- bool isNoteOn () const
- bool isPitchBend () const
- FORCEINLINE bool isSynchronousWith (const CMidiEvent &event)
- virtual bool operator!= (const CMidiEvent &event)
- bool operator< (const CMidiEvent &event)
- bool operator<= (const CMidiEvent &event)
- CMidiEvent & operator= (const CMidiEvent &event)
- virtual bool operator== (const CMidiEvent &event)
- bool operator> (const CMidiEvent &event)
- bool operator>= (const CMidiEvent &event)
- FORCEINLINE void setChannel (const long channel)
- FORCEINLINE void setEvent (const long status, const long value, const long subValue, const long channel, const long delta)
- FORCEINLINE void setPitchBend (const double pitchBend)
- FORCEINLINE void setStatus (const long status)
- FORCEINLINE void setSubValue (const long value)
- FORCEINLINE void setTimeDelta (const long delta)
- FORCEINLINE void setValue (const long value)
- virtual ~CMidiEvent ()

## Static Public Member Functions

- static int compareMidiEvents (const CMidiEvent **event1, const CMidiEvent **event2)

## Protected Attributes

- long m_channel
- double m_pitchBend
- long m_status
- long m_subValue
- long m_timeDelta
- long m_value

## Constructor & Destructor Documentation

Exponent::Midi::CMidiEvent::CMidiEvent | ( | const long | status = `CMidi::CMIDI_MIDI_NONE`,
|  | const long | value = `0`,
|  | const long | subValue = `0`,
|  | const long | channel = `1`,
|  | const long | delta = `0` |
| ) |  |  |

Construction

Parameters:

  | status | Midi status
  | value | Byte 1 of the midi info
  | subValue | Bytes 2 of the midi info
  | channel | The miid channel
  | delta | The time delta, in samples from the start of the block (ion case of a midi file this is from the start of the file), block can be taken to mean the start of the last relevant position to the audio process

Exponent::Midi::CMidiEvent::CMidiEvent | ( | const CMidiEvent & | event | ) |

Copy construction

Parameters:

  | event | The event to copy

virtual Exponent::Midi::CMidiEvent::~CMidiEvent | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

static int Exponent::Midi::CMidiEvent::compareMidiEvents | ( | const CMidiEvent ** | event1,
|  | const CMidiEvent ** | event2 |
| ) |  |  | `[static]`

Comparison for a qsort

Parameters:

  | event1 | The first event
  | event2 | The second event

Return values:

  | <0 | class1 goes before class2 0 class1 == class2 >0 class1 goes after class2

See also:
  CClassManager::classCompareFunction

  TPointerCollection::qsortCompare

FORCEINLINE const long Exponent::Midi::CMidiEvent::getChannel | ( |  | ) | const`[inline]`

Get the channel

Return values:

  | const | long The midi channel

Definition at line 164 of file CMidiEvent.hpp.

References m_channel.

virtual void Exponent::Midi::CMidiEvent::getObjectDescription | ( | char * | string,
|  | const long | size |
| ) |  |  | const`[virtual]`

Get a description of the object

Parameters:

  | string | On return is filled with the description
  | size | The size of the stirng

Reimplemented from Exponent::Basics::CCountedObject.

FORCEINLINE double Exponent::Midi::CMidiEvent::getPitchBend | ( |  | ) | const`[inline]`

Get pitch bend value

Return values:

  | double | The pitch bend value as a value -1 -> 1, where 0 is no pitch bend

Definition at line 176 of file CMidiEvent.hpp.

References m_pitchBend.

FORCEINLINE const long Exponent::Midi::CMidiEvent::getStatus | ( |  | ) | const`[inline]`

Get the status

Return values:

  | const | long The status

Definition at line 146 of file CMidiEvent.hpp.

References m_status.

FORCEINLINE const long Exponent::Midi::CMidiEvent::getSubValue | ( |  | ) | const`[inline]`

Get the sub value

Return values:

  | const | long Sub value

Definition at line 158 of file CMidiEvent.hpp.

References m_subValue.

FORCEINLINE const long Exponent::Midi::CMidiEvent::getTimeDelta | ( |  | ) | const`[inline]`

Get the time delta

Return values:

  | const | long The time delta

Definition at line 170 of file CMidiEvent.hpp.

References m_timeDelta.

FORCEINLINE const long Exponent::Midi::CMidiEvent::getValue | ( |  | ) | const`[inline]`

Get the value

Return values:

  | const | long Main value

Definition at line 152 of file CMidiEvent.hpp.

References m_value.

bool Exponent::Midi::CMidiEvent::isAllNotesOff | ( |  | ) | const`[inline]`

Is this an all notes off message

Return values:

  | bool | True if all notes off, false otherwise

Definition at line 263 of file CMidiEvent.hpp.

References Exponent::Midi::CMidi::CMIDI_ALL_NOTES_OFF, and m_status.

bool Exponent::Midi::CMidiEvent::isControlChange | ( |  | ) | const`[inline]`

Is control change message

Return values:

  | bool | True if control change message, false otherwise

Definition at line 269 of file CMidiEvent.hpp.

References Exponent::Midi::CMidi::CMIDI_CONTROL_CHANGE, and m_status.

bool Exponent::Midi::CMidiEvent::isNoteOff | ( |  | ) | const`[inline]`

Is this a note off message

Return values:

  | bool | True if Note off, false otherwise

Definition at line 257 of file CMidiEvent.hpp.

References Exponent::Midi::CMidi::CMIDI_NOTE_OFF, Exponent::Midi::CMidi::CMIDI_NOTE_ON, m_status, and m_subValue.

bool Exponent::Midi::CMidiEvent::isNoteOn | ( |  | ) | const`[inline]`

Is this a note on message

Return values:

  | bool | True if Note on, false otherwise

Definition at line 251 of file CMidiEvent.hpp.

References Exponent::Midi::CMidi::CMIDI_NOTE_ON, m_status, and m_subValue.

bool Exponent::Midi::CMidiEvent::isPitchBend | ( |  | ) | const`[inline]`

Is a pitch bend message

Return values:

  | bool | True if this is a pitch bend message, false otherwise

Definition at line 275 of file CMidiEvent.hpp.

References Exponent::Midi::CMidi::CMIDI_PITCH_BEND, and m_status.

FORCEINLINE bool Exponent::Midi::CMidiEvent::isSynchronousWith | ( | const CMidiEvent & | event | ) | `[inline]`

Do the events happen at the same time

Parameters:

  | event | The event to compare with

Return values:

  | bool | True if time deltas are equal, false otherwise

Definition at line 240 of file CMidiEvent.hpp.

References m_timeDelta.

virtual bool Exponent::Midi::CMidiEvent::operator!= | ( | const CMidiEvent & | event | ) | `[virtual]`

Inequality operator

Parameters:

  | event | The event to compare to

Return values:

  | bool | True if events are not synchronous, false otherwise

See also:
  isSynchronousWith

bool Exponent::Midi::CMidiEvent::operator< | ( | const CMidiEvent & | event | ) |

Less than operator

Parameters:

  | event | The event to compare to

Return values:

  | bool | True if timeDelta is less than events time delta, false otherwise

bool Exponent::Midi::CMidiEvent::operator<= | ( | const CMidiEvent & | event | ) |

Less than or equal operator

Parameters:

  | event | The event to compare to

Return values:

  | bool | True if timeDelta is less than or equal events time delta, false otherwise

CMidiEvent& Exponent::Midi::CMidiEvent::operator= | ( | const CMidiEvent & | event | ) |

Assignment operator

Parameters:

  | event | The event to copy

Return values:

  | CMidiEvent& | A reference to this

virtual bool Exponent::Midi::CMidiEvent::operator== | ( | const CMidiEvent & | event | ) | `[virtual]`

Equality operator

Parameters:

  | event | The event to compare to

Return values:

  | bool | True if events are synchronous, false otherwise

See also:
  isSynchronousWith

bool Exponent::Midi::CMidiEvent::operator> | ( | const CMidiEvent & | event | ) |

Greater than operator

Parameters:

  | event | The event to compare to

Return values:

  | bool | True if timeDelta is greater than events time delta, false otherwise

bool Exponent::Midi::CMidiEvent::operator>= | ( | const CMidiEvent & | event | ) |

Greater than or euql operator

Parameters:

  | event | The event to compare to

Return values:

  | bool | True if timeDelta is greater than events time delta, false otherwise

FORCEINLINE void Exponent::Midi::CMidiEvent::setChannel | ( | const long | channel | ) | `[inline]`

Set the channel

Parameters:

  | channel | The midi channel

Definition at line 202 of file CMidiEvent.hpp.

References m_channel.

FORCEINLINE void Exponent::Midi::CMidiEvent::setEvent | ( | const long | status,
|  | const long | value,
|  | const long | subValue,
|  | const long | channel,
|  | const long | delta |
| ) |  |  | `[inline]`

Set all values

Parameters:

  | status | Midi status
  | value | Byte 1 of the midi info
  | subValue | Bytes 2 of the midi info
  | channel | The miid channel
  | delta | The time delta

Definition at line 224 of file CMidiEvent.hpp.

References m_channel, m_status, m_subValue, m_timeDelta, and m_value.

FORCEINLINE void Exponent::Midi::CMidiEvent::setPitchBend | ( | const double | pitchBend | ) | `[inline]`

Set the pitch bend

Parameters:

  | pitchBend | Should be in the range -1 -> +1 with 0 being no bend

Definition at line 214 of file CMidiEvent.hpp.

References m_pitchBend.

FORCEINLINE void Exponent::Midi::CMidiEvent::setStatus | ( | const long | status | ) | `[inline]`

Set the status

Parameters:

  | status | The status

Definition at line 184 of file CMidiEvent.hpp.

References m_status.

FORCEINLINE void Exponent::Midi::CMidiEvent::setSubValue | ( | const long | value | ) | `[inline]`

Set the subvalue

Parameters:

  | value | The sub value

Definition at line 196 of file CMidiEvent.hpp.

References m_subValue.

FORCEINLINE void Exponent::Midi::CMidiEvent::setTimeDelta | ( | const long | delta | ) | `[inline]`

Set the time delta

Parameters:

  | delta | The time delta

Definition at line 208 of file CMidiEvent.hpp.

References m_timeDelta.

FORCEINLINE void Exponent::Midi::CMidiEvent::setValue | ( | const long | value | ) | `[inline]`

Set the value

Parameters:

  | value | The main value

Definition at line 190 of file CMidiEvent.hpp.

References m_value.

## Member Data Documentation

long Exponent::Midi::CMidiEvent::m_channel`[protected]`

midi channel

Definition at line 295 of file CMidiEvent.hpp.

Referenced by getChannel(), setChannel(), and setEvent().

double Exponent::Midi::CMidiEvent::m_pitchBend`[protected]`

the pitch bend amount

Definition at line 297 of file CMidiEvent.hpp.

Referenced by getPitchBend(), and setPitchBend().

long Exponent::Midi::CMidiEvent::m_status`[protected]`

Note on, Note off, control change, all notes off....

Definition at line 292 of file CMidiEvent.hpp.

Referenced by getStatus(), isAllNotesOff(), isControlChange(), isNoteOff(), isNoteOn(), isPitchBend(), setEvent(), and setStatus().

long Exponent::Midi::CMidiEvent::m_subValue`[protected]`

velocity, value

Definition at line 294 of file CMidiEvent.hpp.

Referenced by getSubValue(), isNoteOff(), isNoteOn(), setEvent(), and setSubValue().

long Exponent::Midi::CMidiEvent::m_timeDelta`[protected]`

time delta within buffer in samples

Definition at line 296 of file CMidiEvent.hpp.

Referenced by getTimeDelta(), isSynchronousWith(), setEvent(), and setTimeDelta().

long Exponent::Midi::CMidiEvent::m_value`[protected]`

note, cc number

Definition at line 293 of file CMidiEvent.hpp.

Referenced by getValue(), setEvent(), and setValue().