LMMS
Loading...
Searching...
No Matches
Alg_event_list Class Reference

#include <allegro.h>

Inheritance diagram for Alg_event_list:
Alg_events Alg_track Alg_seq

Public Member Functions

virtual Alg_event_ptroperator[] (int i)
 Alg_event_list ()
 Alg_event_list (Alg_track *owner)
char get_type ()
Alg_trackget_owner ()
 ~Alg_event_list () override=default
double get_beat_dur ()
 Returns the duration of the sequence in beats or seconds.
void set_beat_dur (double d)
double get_real_dur ()
void set_real_dur (double d)
virtual void set_start_time (Alg_event *event, double)
const char * get_last_error_message ()
 get text description of run-time errors detected, clear error
Public Member Functions inherited from Alg_events
virtual int length ()
Alg_event_ptroperator[] (int i)
 Alg_events ()
virtual ~Alg_events ()
void set_events (Alg_event_ptr *e, long l, long m)
void insert (Alg_event_ptr event)
 for use by Alg_track and Alg_seq
void append (Alg_event_ptr event)
Alg_event_ptr uninsert (long index)

Protected Attributes

char type
 'e' Alg_event_list, 't' Alg_track, 's' Alg_seq
Alg_trackevents_owner
 the events are owned by an Alg_track or an Alg_seq
int sequence_number
double beat_dur
double real_dur
Protected Attributes inherited from Alg_events
long len
Alg_event_ptrevents
 events is array of pointers

Static Protected Attributes

static const char * last_error_message
static int sequences
 to keep track of sequence numbers

Additional Inherited Members

Public Attributes inherited from Alg_events
double last_note_off
bool in_use

Detailed Description

Implementation hint: keep a sequence number on each Alg_track that is incremented anytime there is a structural change. (This behavior is inherited by Alg_seq as well.) Copy the sequence number to any Alg_event_list object when it is created. Whenever you access an Alg_event_list, using operator[], assert that the Alg_event_list sequence number matches the Alg_seq sequence number. This will guarantee that you do not try to retain pointers to events beyond the point where the events may no longer exist.

Constructor & Destructor Documentation

◆ Alg_event_list() [1/2]

Alg_event_list::Alg_event_list ( )
inline

◆ Alg_event_list() [2/2]

Alg_event_list::Alg_event_list ( Alg_track * owner)

◆ ~Alg_event_list()

Alg_event_list::~Alg_event_list ( )
overridedefault

The destructor does not free events because they are owned by a track or seq structure.

Member Function Documentation

◆ get_beat_dur()

double Alg_event_list::get_beat_dur ( )
inline

Returns the duration of the sequence in beats or seconds.

◆ get_last_error_message()

const char * Alg_event_list::get_last_error_message ( )
inline

get text description of run-time errors detected, clear error

◆ get_owner()

Alg_track * Alg_event_list::get_owner ( )
inline

◆ get_real_dur()

double Alg_event_list::get_real_dur ( )
inline

◆ get_type()

char Alg_event_list::get_type ( )
inline

◆ operator[]()

Alg_event_ptr & Alg_event_list::operator[] ( int i)
virtual

the client should not create one of these, but these are returned from various track and seq operations. An Alg_event_list "knows" the Alg_track or Alg_seq that "owns" the events. All events in an Alg_event_list must belong to the same Alg_track or Alg_seq structure. When applied to an Alg_seq, events are enumerated track by track with increasing indices. This operation is not particularly fast on an Alg_seq.

Reimplemented in Alg_seq, and Alg_track.

◆ set_beat_dur()

void Alg_event_list::set_beat_dur ( double d)
inline

◆ set_real_dur()

void Alg_event_list::set_real_dur ( double d)
inline

◆ set_start_time()

void Alg_event_list::set_start_time ( Alg_event * event,
double t )
virtual

Events are stored in time order, so when you change the time of an event, you must adjust the position. When you call set_start_time on an Alg_event_list, the Alg_event_list is not modified, but the Alg_track that "owns" the event is modified. If the owner is an Alg_seq, this may require searching the seq for the track containing the event. This will mean a logN search of every track in the seq (but if this turns out to be a problem, we can store each event's track owner in the Alg_event_list.)

Member Data Documentation

◆ beat_dur

double Alg_event_list::beat_dur
protected

every event list, track, and seq has a duration. Usually the duration is set when the list is constructed, e.g. when you extract from 10 to 15 seconds, the duration is 5 secs. The duration does not tell you when is the last note-off. duration is recorded in both beats and seconds:

◆ events_owner

Alg_track* Alg_event_list::events_owner
protected

the events are owned by an Alg_track or an Alg_seq

if this is an Alg_event_list,

◆ last_error_message

const char* Alg_event_list::last_error_message
staticprotected

◆ real_dur

double Alg_event_list::real_dur
protected

◆ sequence_number

int Alg_event_list::sequence_number
protected

this sequence number is incremented whenever an edit is performed on an Alg_track or Alg_seq. When an Alg_event_list is created to contain pointers to a subset of an Alg_track or Alg_seq (the events_owner), the Alg_event_list gets a copy of the events_owner's sequence_number. If the events_owner is edited, the pointers in this Alg_event_list will become invalid. This is detected (for debugging) as differing sequence_numbers.

◆ sequences

int Alg_event_list::sequences
staticprotected

to keep track of sequence numbers

◆ type

char Alg_event_list::type
protected

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