class EventTrack

A simple track containing Event objects. More...

Full nameTSE3::EventTrack
Definition#include <EventTrack.h>
Template formEventTrack<class etype>
InheritsTSE3::Notifier [public ], TSE3::Playable [public ]
Inherited byFlagTrack, KeySigTrack, RepeatTrack, TempoTrack, TimeSigTrack
List of all Methods
Annotated List

Public Types

Public Methods

Protected Members

Detailed Description

The EventTrack provides a simple track containing a given type of events.

It is used with instantiations of the Event generic class.

The EventTrack is used as a base class for other types of TSE3 track, for example the TimeSigTrack and TempoTrack.

The contained Event objects are held by value.

The EventTrack has two modes of operating, specified as a boolean parameter in the constructor. The normal operation (as used by most subclasses) is to prevent the insertion of two events with the same time. For example, you don't want to have two different time signatures at the same time. The second mode of operation allows this time duplication.

See also: Event, EventTrackListener

 EventTrack (bool allowDuplicates = false)


Creates an EventTrack.

The parameter specifies whether or not duplicate time values are allowed in the EventTrack. When false, you may not insert two events with the same time.

allowDuplicatesWhether to allow duplicate time values

 ~EventTrack ()


typedef Event event_type


size_t  size ()



Returns the number of events in this track.

Returns: The number of events in this track

event_type const & operator[] (const size_t n)



Returns the nth event in the track.

The value returned for an index that is out of range is undefined. The size method describes the valid values.


Returns: Event at index n

int  index (const Clock c, bool roundup = true)


Returns the index of the event at a given Clock.

cClock value to search for.
roundupIf true index returns the event at or after the specified Clock. If false, returns the event at of before the specified Clock.

Returns: Index of event. If past the end of the data then returns 'size'.

size_t  insert (const event_type &event)


Inserts an Event into the EventTrack, and returns the index of the insertion point.

If duplicate times are not allowed (see EventTrack::EventTrack) then the new Event will replace the existing Event at this time.

If duplicate times are allowed then the new Event is inserted after any other events with the same time.

eventThe event to insert

Returns: Index of new event

See also: erase

void  erase (const event_type &event)


Erase an event.

If the event is not in this track then no error is raised.

eventThe event to erase

See also: insert

void  erase (size_t index)


Erase an event.

If the index is invalid then no error is raised.

indexIndex of the event to erase

See also: insert

std::vector data