AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
Loading...
Searching...
No Matches
AudioDataLib::MidiData::Track Class Reference

This is a single time-line of MIDI messages (also called events), or a sequence of MIDI messages meant to execute one after another. More...

#include <MidiData.h>

Public Member Functions

 Track ()
 
virtual ~Track ()
 
void Clear ()
 
template<typename T >
const T * FindEvent (std::function< bool(T *)> matchFunc) const
 
const MetaEventFindMetaEventOfType (uint8_t type) const
 
const EventGetEvent (uint32_t i) const
 
const std::vector< Event * > & GetEventArray () const
 
void AddEvent (Event *event)
 

Detailed Description

This is a single time-line of MIDI messages (also called events), or a sequence of MIDI messages meant to execute one after another.

A MIDI file can contain one or more tracks, all meant to play in parallel with one another. That is, unless the FormatType is VARIOUS_TRACKS, in which case, the tracks are independent, I believe.

Constructor & Destructor Documentation

◆ Track()

MidiData::Track::Track ( )

◆ ~Track()

MidiData::Track::~Track ( )
virtual

Member Function Documentation

◆ AddEvent()

void AudioDataLib::MidiData::Track::AddEvent ( Event * event)
inline

Append the given event object to this track's event array. Note that this class takes ownership of the event memory, and it is expected that the given event is allocated on the heap.

◆ Clear()

void MidiData::Track::Clear ( )

Remove all MIDI messages from this track.

◆ FindEvent()

template<typename T >
const T * AudioDataLib::MidiData::Track::FindEvent ( std::function< bool(T *)> matchFunc) const
inline

Find a MIDI message in the track of the given type using the given predicate.

Parameters
[in]TThe type of MIDI message.
[in]matchFuncA lambda to return true if the given event is the one for which you are looking.
Returns
Returns a pointer to the found event, if any, or nullptr if not found.

◆ FindMetaEventOfType()

const MetaEvent * AudioDataLib::MidiData::Track::FindMetaEventOfType ( uint8_t type) const
inline

Find a meta-event of the given type in this track.

Parameters
[in]typeThe type of meta-event. See the MetaEvent::Type enumeration.
Returns
Returns a pointer to the found event, if any, or nullptr if not found.

◆ GetEvent()

const MidiData::Event * MidiData::Track::GetEvent ( uint32_t i) const

Get a pointer to an event in the track at the given offset.

Parameters
[in]iEvents are stored in an array. This is the offset into that array to the desired event.
Returns
The desired event at the given offset is returned, or nullptr if the given offset is out of range.

◆ GetEventArray()

const std::vector< Event * > & AudioDataLib::MidiData::Track::GetEventArray ( ) const
inline

For convenient, get a reference to the event array owned by the Track class.


The documentation for this class was generated from the following files: