LMMS
Loading...
Searching...
No Matches
Alg_event Class Referenceabstract

abstract superclass of Alg_note and Alg_update: More...

#include <allegro.h>

Inheritance diagram for Alg_event:
Alg_note Alg_update

Public Member Functions

virtual void show ()=0
bool is_note ()
 tell whether an Alg_event is a note
bool is_update ()
 tell whether an Alg_event is a parameter update
char get_type ()
 return 'n' for note, 'u' for update
int get_type_code ()
bool get_selected ()
void set_selected (bool b)
long get_identifier ()
 get MIDI key or note identifier of note or update
void set_identifier (long i)
void set_parameter (Alg_parameter_ptr new_parameter)
void set_string_value (const char *attr, const char *value)
void set_real_value (const char *attr, double value)
void set_logical_value (const char *attr, bool value)
void set_integer_value (const char *attr, int32_t value)
void set_atom_value (const char *attr, const char *atom)
float get_pitch ()
 get pitch in steps – use this even for MIDI
float get_loud ()
 get loudness (MIDI velocity)
double get_start_time ()
 get start time in seconds or beats
double get_end_time ()
 get end time in seconds or beats
double get_duration ()
 get duration in seconds or beats
void set_pitch (float)
void set_loud (float)
void set_duration (double)
bool has_attribute (const char *attr)
 test if note has attribute/value pair
char get_attribute_type (const char *attr)
const char * get_string_value (const char *attr, const char *value=nullptr)
 get the string value
double get_real_value (const char *attr, double value=0.0)
 get the real value
bool get_logical_value (const char *attr, bool value=false)
 get the logical value
long get_integer_value (const char *attr, int32_t value=0)
 get the integer value
const char * get_atom_value (const char *attr, const char *value=nullptr)
 get the atom value
void delete_attribute (const char *attr)
 (ignore if no matching attribute/value pair exists)
const char * get_attribute ()
 get the update's attribute (string)
char get_update_type ()
const char * get_string_value ()
double get_real_value ()
 get the update's real value
bool get_logical_value ()
 get the update's logical value
int32_t get_integer_value ()
 get the update's integer value
const char * get_atom_value ()
bool overlap (double t, double len, bool all)
const char * GetDescription ()
 the result is in a static buffer, not thread-safe, just for debugging.
 Alg_event ()
virtual ~Alg_event ()=default

Public Attributes

double time
long chan

Protected Attributes

bool selected
char type
 'e' event, 'n' note, 'u' update
long key
 note identifier

Static Protected Attributes

static const char * description
 static buffer for debugging (in Alg_event)

Detailed Description

abstract superclass of Alg_note and Alg_update:

Constructor & Destructor Documentation

◆ Alg_event()

Alg_event::Alg_event ( )
inline

◆ ~Alg_event()

virtual Alg_event::~Alg_event ( )
virtualdefault

Member Function Documentation

◆ delete_attribute()

void Alg_event::delete_attribute ( const char * attr)

(ignore if no matching attribute/value pair exists)

delete an attribute/value pair

◆ get_atom_value() [1/2]

const char * Alg_event::get_atom_value ( )

get the update's atom value Notes: Caller does not own the return value. Do not modify. The return value's lifetime is forever.

◆ get_atom_value() [2/2]

const char * Alg_event::get_atom_value ( const char * attr,
const char * value = nullptr )

get the atom value

◆ get_attribute()

const char * Alg_event::get_attribute ( )

get the update's attribute (string)

Some attribute/value methods. These fail if this is not an update. Attributes are converted to/from strings to avoid explicit use of Alg_attribute types.

◆ get_attribute_type()

char Alg_event::get_attribute_type ( const char * attr)

get the associated type: 's' = string, 'r' = real (double), 'l' = logical (bool), 'i' = integer (long), 'a' = atom (char *), a unique string stored in Alg_seq

◆ get_duration()

double Alg_event::get_duration ( )

get duration in seconds or beats

◆ get_end_time()

double Alg_event::get_end_time ( )

get end time in seconds or beats

◆ get_identifier()

long Alg_event::get_identifier ( )
inline

get MIDI key or note identifier of note or update

◆ get_integer_value() [1/2]

int32_t Alg_event::get_integer_value ( )

get the update's integer value

◆ get_integer_value() [2/2]

long Alg_event::get_integer_value ( const char * attr,
int32_t value = 0 )

get the integer value

◆ get_logical_value() [1/2]

bool Alg_event::get_logical_value ( )

get the update's logical value

◆ get_logical_value() [2/2]

bool Alg_event::get_logical_value ( const char * attr,
bool value = false )

get the logical value

◆ get_loud()

float Alg_event::get_loud ( )

get loudness (MIDI velocity)

◆ get_pitch()

float Alg_event::get_pitch ( )

get pitch in steps – use this even for MIDI

◆ get_real_value() [1/2]

double Alg_event::get_real_value ( )

get the update's real value

◆ get_real_value() [2/2]

double Alg_event::get_real_value ( const char * attr,
double value = 0.0 )

get the real value

◆ get_selected()

bool Alg_event::get_selected ( )
inline

◆ get_start_time()

double Alg_event::get_start_time ( )

get start time in seconds or beats

◆ get_string_value() [1/2]

const char * Alg_event::get_string_value ( )

get the update's string value Notes: Caller does not own the return value. Do not modify. Do not use after underlying Alg_seq is modified.

◆ get_string_value() [2/2]

const char * Alg_event::get_string_value ( const char * attr,
const char * value = nullptr )

get the string value

◆ get_type()

char Alg_event::get_type ( )
inline

return 'n' for note, 'u' for update

◆ get_type_code()

int Alg_event::get_type_code ( )

1 = volume change, 2 = pitch bend, 3 = control change, 4 = program change, 5 = pressure change, 6 = key signature, 7 = time sig numerator, 8 = time sig denominator

◆ get_update_type()

char Alg_event::get_update_type ( )

get the update's type: 's' = string, 'r' = real (double), 'l' = logical (bool), 'i' = integer (long), 'a' = atom (char *), a unique string stored in Alg_seq

◆ GetDescription()

const char * Alg_event::GetDescription ( )

the result is in a static buffer, not thread-safe, just for debugging.

computes a text description of this event

◆ has_attribute()

bool Alg_event::has_attribute ( const char * attr)

test if note has attribute/value pair

Notes have lists of attribute values. Attributes are converted to/from strings in this API to avoid explicit use of Alg_attribute types. Attribute names end with a type designation: 's', 'r', 'l', 'i', or 'a'.

◆ is_note()

bool Alg_event::is_note ( )
inline

tell whether an Alg_event is a note

◆ is_update()

bool Alg_event::is_update ( )
inline

tell whether an Alg_event is a parameter update

◆ overlap()

bool Alg_event::overlap ( double t,
double len,
bool all )

Auxiliary function to aid in editing tracks Returns true if the event overlaps the given region

◆ set_atom_value()

void Alg_event::set_atom_value ( const char * attr,
const char * atom )

◆ set_duration()

void Alg_event::set_duration ( double d)

◆ set_identifier()

void Alg_event::set_identifier ( long i)
inline

set the identifier

◆ set_integer_value()

void Alg_event::set_integer_value ( const char * attr,
int32_t value )

◆ set_logical_value()

void Alg_event::set_logical_value ( const char * attr,
bool value )

◆ set_loud()

void Alg_event::set_loud ( float l)

◆ set_parameter()

void Alg_event::set_parameter ( Alg_parameter_ptr new_parameter)

In all of these set_ methods, strings are owned by the caller and copied as necessary by the callee. For notes, an attribute/value pair is added to the parameters list. For updates, the single attribute/value parameter pair is overwritten. In all cases, the attribute (first argument) must agree in type with the second arg. The last letter of the attribute implies the type (see below).

◆ set_pitch()

void Alg_event::set_pitch ( float p)

◆ set_real_value()

void Alg_event::set_real_value ( const char * attr,
double value )

◆ set_selected()

void Alg_event::set_selected ( bool b)
inline

◆ set_string_value()

void Alg_event::set_string_value ( const char * attr,
const char * value )

◆ show()

virtual void Alg_event::show ( )
pure virtual

Implemented in Alg_note, and Alg_update.

Member Data Documentation

◆ chan

long Alg_event::chan

◆ description

const char* Alg_event::description
staticprotected

static buffer for debugging (in Alg_event)

◆ key

long Alg_event::key
protected

note identifier

◆ selected

bool Alg_event::selected
protected

◆ time

double Alg_event::time

◆ type

char Alg_event::type
protected

'e' event, 'n' note, 'u' update


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