lmms
Cross-platform music production software
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
 Symbol table of Alg_attribute objects and other unique strings. More...
class  Alg_parameter
 An attribute/value pair. More...
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
 Used to contruct a tempo map. More...
class  Alg_beats
 A list of Alg_beat objects used in Alg_seq. More...
class  Alg_time_map
class  Serial_buffer
 Abstract class with common elements of Serial_read_buffer and Serial_write_buffer. More...
class  Serial_read_buffer
class  Serial_write_buffer
class  Alg_track
class  Alg_time_sig
 Represents a single time signature. More...
class  Alg_time_sigs
 A dynamic array of Alg_time_sig objects. More...
class  Alg_tracks
 A sequence of Alg_events objects. More...
struct  Alg_pending_event
class  Alg_iterator
class  Alg_seq
 An array of Alg_events. More...

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

Enumerations

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

Functions

bool within (double d1, double d2, double epsilon)
 Checks if 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 *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)

◆ 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; for example, the attribute 'tempor' (a real number representing tempo) is stored as 'rtempor'. To get the string name, just use attribute+1 (see alg_attr_name).

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.

Todo
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 )

Checks if d1 and d2 within epsilon of each other.

Variable Documentation

◆ symbol_table

DLLEXPORT Alg_atoms symbol_table
extern