LMMS
Loading...
Searching...
No Matches
allegro.h File Reference
#include <cassert>
#include <cstdint>
#include <cstring>
#include <iostream>

Go to the source code of this file.

Classes

class  Alg_atoms
class  Alg_parameter
class  Alg_parameters
 a list of attribute/value pairs More...
class  Alg_event
 abstract superclass of Alg_note and Alg_update: More...
class  Alg_note
class  Alg_update
class  Alg_events
 a sequence of Alg_event objects More...
class  Alg_event_list
class  Alg_beat
 Alg_beat is used to contruct a tempo map. More...
class  Alg_beats
 Alg_beats is a list of Alg_beat objects used in Alg_seq. More...
class  Alg_time_map
class  Serial_buffer
class  Serial_read_buffer
class  Serial_write_buffer
class  Alg_track
class  Alg_time_sig
class  Alg_time_sigs
 Alg_time_sigs is a dynamic array of time signatures. More...
class  Alg_tracks
 a sequence of Alg_events objects More...
struct  Alg_pending_event
class  Alg_iterator
class  Alg_seq

Macros

#define ALG_EPS   0.000001
 epsilon
#define ALG_DEFAULT_BPM   100.0
 default tempo
#define alg_attr_name(a)
#define alg_attr_type(a)
#define DLLEXPORT
#define ALG_NOTE   0
 This is a note, not an update.
#define ALG_GATE   1
 "gate"
#define ALG_BEND   2
 "bend"
#define ALG_CONTROL   3
 "control"
#define ALG_PROGRAM   4
 "program"
#define ALG_PRESSURE   5
 "pressure"
#define ALG_KEYSIG   6
 "keysig"
#define ALG_TIMESIG_NUM   7
 "timesig_num"
#define ALG_TIMESIG_DEN   8
 "timesig_den"
#define ALG_OTHER   9
 any other value

Typedefs

typedef const char * Alg_attribute
typedef class Alg_parameterAlg_parameter_ptr
typedef class Alg_parametersAlg_parameters_ptr
 a list of attribute/value pairs
typedef class Alg_eventAlg_event_ptr
 abstract superclass of Alg_note and Alg_update:
typedef Alg_noteAlg_note_ptr
typedef Alg_updateAlg_update_ptr
typedef class Alg_eventsAlg_events_ptr
 a sequence of Alg_event objects
typedef Alg_event_listAlg_event_list_ptr
typedef Alg_event_listAlg_event_list_ref
typedef class Alg_beatAlg_beat_ptr
 Alg_beat is used to contruct a tempo map.
typedef class Alg_beatsAlg_beats_ptr
 Alg_beats is a list of Alg_beat objects used in Alg_seq.
typedef class Alg_time_mapAlg_time_map_ptr
typedef Serial_read_bufferSerial_read_buffer_ptr
typedef Serial_write_bufferSerial_write_buffer_ptr
typedef class Alg_seqAlg_seq_ptr
typedef Alg_trackAlg_track_ptr
typedef Alg_trackAlg_track_ref
typedef class Alg_time_sigAlg_time_sig_ptr
typedef class Alg_tracksAlg_tracks_ptr
 a sequence of Alg_events objects
typedef struct Alg_pending_eventAlg_pending_event_ptr
typedef class Alg_iteratorAlg_iterator_ptr
typedef Alg_seqAlg_seq_ref

Enumerations

enum  Alg_error { alg_no_error = 0 , alg_error_open = -800 , alg_error_syntax }

Functions

bool within (double d1, double d2, double epsilon)
 are d1 and d2 within epsilon of each other?
char * heapify (const char *s)
 put a string on the heap

Variables

DLLEXPORT Alg_atoms symbol_table

Detailed Description

Portsmf (also known as Allegro): music representation system, with extensible in-memory sequence structure upward compatible with MIDI implementations in C++ and Serpent external, text-based representation compatible with Aura

SERIALBUFFER CLASS

The Serial_buffer class is defined to support serialization and unserialization. A Serial_buffer is just a block of memory with a length and a read/write pointer. When writing, it can expand.

SERIALIZATION

The Alg_track class has static members: ser_buf – a Serial_buffer When objects are serialized, they are first written to ser_buf, which is expanded whenever necessary. Then, when the length is known, new memory is allocated and the data is copied to a correctly-sized buffer and returned to caller. The "external" (callable from outside the library) serialization functions are: Alg_track::serialize() Alg_seq::serialize() The "internal" serialization functions to be called from within the library are: Alg_track::serialize_track(bool text) Alg_seq::serialize_seq(bool text) Alg_track::serialize_parameter( Alg_parameter *parm, bool text) These internal serialize functions append data to ser_buf The text flag says to write an ascii representation as opposed to binary.

UNSERIALIZATION:

The Alg_track class has a static member: unserialize(char *buffer, long len) that will unserialize anything – an Alg_track or an Alg_seq. No other function should be called from outside the library. Internal unserialize functions are: Alg_seq::unserialize_seq() Alg_track::unserialize_track() Alg_track::unserialize_parameter(Alg_parameter_ptr parm_ptr) Just as serialization uses ser_buf for output, unserialization uses unser_buf for reading. unser_buf is another static member of Alg_track.

Macro Definition Documentation

◆ alg_attr_name

#define alg_attr_name ( a)
Value:
((a) + 1)
uint8_t a
Definition Spc_Cpu.h:141

◆ alg_attr_type

#define alg_attr_type ( a)
Value:
(*(a))

◆ ALG_BEND

#define ALG_BEND   2

"bend"

◆ ALG_CONTROL

#define ALG_CONTROL   3

"control"

◆ ALG_DEFAULT_BPM

#define ALG_DEFAULT_BPM   100.0

default tempo

◆ ALG_EPS

#define ALG_EPS   0.000001

epsilon

◆ ALG_GATE

#define ALG_GATE   1

"gate"

◆ ALG_KEYSIG

#define ALG_KEYSIG   6

"keysig"

◆ ALG_NOTE

#define ALG_NOTE   0

This is a note, not an update.

◆ ALG_OTHER

#define ALG_OTHER   9

any other value

◆ ALG_PRESSURE

#define ALG_PRESSURE   5

"pressure"

◆ ALG_PROGRAM

#define ALG_PROGRAM   4

"program"

◆ ALG_TIMESIG_DEN

#define ALG_TIMESIG_DEN   8

"timesig_den"

◆ ALG_TIMESIG_NUM

#define ALG_TIMESIG_NUM   7

"timesig_num"

◆ DLLEXPORT

#define DLLEXPORT

Typedef Documentation

◆ Alg_attribute

typedef const char* Alg_attribute

Alg_attribute is an atom in the symbol table with the special addition that the last character is prefixed to the string; thus, the attribute 'tempor' (a real) is stored as 'rtempor'. To get the string name, just use attribute+1.

◆ Alg_beat_ptr

typedef class Alg_beat * Alg_beat_ptr

Alg_beat is used to contruct a tempo map.

◆ Alg_beats_ptr

typedef class Alg_beats * Alg_beats_ptr

Alg_beats is a list of Alg_beat objects used in Alg_seq.

◆ Alg_event_list_ptr

◆ Alg_event_list_ref

◆ Alg_event_ptr

typedef class Alg_event * Alg_event_ptr

abstract superclass of Alg_note and Alg_update:

◆ Alg_events_ptr

typedef class Alg_events * Alg_events_ptr

a sequence of Alg_event objects

◆ Alg_iterator_ptr

typedef class Alg_iterator * Alg_iterator_ptr

◆ Alg_note_ptr

◆ Alg_parameter_ptr

an attribute/value pair. Since Alg_attribute names imply type, we try to keep attributes and values packaged together as Alg_parameter class

◆ Alg_parameters_ptr

a list of attribute/value pairs

◆ Alg_pending_event_ptr

◆ Alg_seq_ptr

typedef Alg_seq * Alg_seq_ptr

An Alg_seq is an array of Alg_events, each a sequence of Alg_event, with a tempo map and a sequence of time signatures

◆ Alg_seq_ref

typedef Alg_seq & Alg_seq_ref

◆ Alg_time_map_ptr

typedef class Alg_time_map * Alg_time_map_ptr

◆ Alg_time_sig_ptr

typedef class Alg_time_sig * Alg_time_sig_ptr

Alg_time_sig represents a single time signature; although not recommended, time_signatures may have arbitrary floating point values, e.g. 4.5 beats per measure

◆ Alg_track_ptr

◆ Alg_track_ref

◆ Alg_tracks_ptr

typedef class Alg_tracks * Alg_tracks_ptr

a sequence of Alg_events objects

◆ Alg_update_ptr

◆ Serial_read_buffer_ptr

◆ Serial_write_buffer_ptr

Enumeration Type Documentation

◆ Alg_error

enum Alg_error
Enumerator
alg_no_error 

no error reading Allegro or MIDI file

alg_error_open 

could not open Allegro or MIDI file

alg_error_syntax 

something found in the file that could not be parsed; generally you should ignore syntax errors or look at the printed error messages because there are some things in standard midi files that we do not handle; (maybe we should only set alg_error_syntax when there is a real problem with the file as opposed to when there is some warning message for the user)

Function Documentation

◆ heapify()

char * heapify ( const char * s)

put a string on the heap

◆ within()

bool within ( double d1,
double d2,
double epsilon )

are d1 and d2 within epsilon of each other?

Variable Documentation

◆ symbol_table

DLLEXPORT Alg_atoms symbol_table
extern