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

#include <allegro.h>

Public Member Functions

 ~Alg_iterator ()
long length ()
 Alg_iterator (Alg_seq_ptr s, bool note_off)
void begin_seq (Alg_seq_ptr s, void *cookie=nullptr, double offset=0.0)
void begin (void *cookie=nullptr)
Alg_event_ptr next (bool *note_on=nullptr, void **cookie_ptr=nullptr, double *offset_ptr=nullptr, double end_time=0)
void request_note_off ()
void end ()
 clean up after enumerating events

Public Attributes

bool note_off_flag

Private Member Functions

void expand ()
void expand_to (int new_max)
void show ()
bool earlier (int i, int j)
void insert (Alg_events_ptr events, long index, bool note_on, void *cookie, double offset)
bool remove_next (Alg_events_ptr &events, long &index, bool &note_on, void *&cookie, double &offset, double &time)
 returns the info on the next pending event in the priority queue

Private Attributes

long maxlen
long len
Alg_seq_ptr seq
Alg_pending_eventpending_events
Alg_events_ptr events_ptr
 the next four fields are mainly for request_note_off()
long index
 remembers index of current event
voidcookie
 remembers the cookie associated with next event
double offset

Constructor & Destructor Documentation

◆ ~Alg_iterator()

Alg_iterator::~Alg_iterator ( )
inline

◆ Alg_iterator()

Alg_iterator::Alg_iterator ( Alg_seq_ptr s,
bool note_off )
inline

Member Function Documentation

◆ begin()

void Alg_iterator::begin ( void * cookie = nullptr)
inline

Prepare to enumerate events in order. If note_off_flag is true, then iteration_next will merge note-off events into the sequence. If you call begin(), you should not normally call begin_seq(). See above.

◆ begin_seq()

void Alg_iterator::begin_seq ( Alg_seq_ptr s,
void * cookie = nullptr,
double offset = 0.0 )

Normally, iteration is over the events in the one sequence used to instatiate the iterator (see above), but with this method, you can add more sequences to the iteration. Events are returned in time order, so effectively sequence events are merged. The optional offset is added to each event time of sequence s before merging/sorting. You should call begin_seq() for each sequence to be included in the iteration unless you call begin() (see below).

◆ earlier()

bool Alg_iterator::earlier ( int i,
int j )
private

◆ end()

void Alg_iterator::end ( )

clean up after enumerating events

◆ expand()

void Alg_iterator::expand ( )
private

◆ expand_to()

void Alg_iterator::expand_to ( int new_max)
private

◆ insert()

void Alg_iterator::insert ( Alg_events_ptr events,
long index,
bool note_on,
void * cookie,
double offset )
private

◆ length()

long Alg_iterator::length ( )
inline

◆ next()

Alg_event_ptr Alg_iterator::next ( bool * note_on = nullptr,
void ** cookie_ptr = nullptr,
double * offset_ptr = nullptr,
double end_time = 0 )

return next event (or nullptr). If iteration_begin was called with note_off_flag = true, and if note_on is not nullptr, then *note_on is set to true when the result value represents a note-on or update. (With note_off_flag, each Alg_note event is returned twice, once at the note-on time, with *note_on == true, and once at the note-off time, with *note_on == false. If a cookie_ptr is passed, then the cookie corresponding to the event is stored at that address If end_time is 0, iterate through the entire sequence, but if end_time is non_zero, stop iterating at the last event before end_time

◆ remove_next()

bool Alg_iterator::remove_next ( Alg_events_ptr & events,
long & index,
bool & note_on,
void *& cookie,
double & offset,
double & time )
private

returns the info on the next pending event in the priority queue

◆ request_note_off()

void Alg_iterator::request_note_off ( )

Sometimes, the caller wants to receive note-off events for a subset of the notes, typically the notes that are played and need to be turned off. In this case, when a note is turned on, the client should call request_note_off(). This will insert a note-off into the queue for the most recent note returned by next().

◆ show()

void Alg_iterator::show ( )
private

Member Data Documentation

◆ cookie

void* Alg_iterator::cookie
private

remembers the cookie associated with next event

◆ events_ptr

Alg_events_ptr Alg_iterator::events_ptr
private

the next four fields are mainly for request_note_off()

remembers events containing current event

◆ index

long Alg_iterator::index
private

remembers index of current event

◆ len

long Alg_iterator::len
private

◆ maxlen

long Alg_iterator::maxlen
private

◆ note_off_flag

bool Alg_iterator::note_off_flag

remembers if we are iterating over note-off events as well as note-on and update events

◆ offset

double Alg_iterator::offset
private

◆ pending_events

Alg_pending_event* Alg_iterator::pending_events
private

◆ seq

Alg_seq_ptr Alg_iterator::seq
private

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