|
LMMS
|
#include <allegro.h>
Public Member Functions | |
| void | basic_initialization () |
| Alg_seq () | |
| Alg_seq (Alg_track_ref track) | |
| Alg_seq (Alg_track_ptr track) | |
| void | seq_from_track (Alg_track_ref tr) |
| Alg_seq (std::istream &file, bool smf, double *offset_ptr=nullptr) | |
| create from file: | |
| Alg_seq (const char *filename, bool smf, double *offset_ptr=nullptr) | |
| create from filename | |
| ~Alg_seq () override | |
| int | get_read_error () |
| void | serialize (void **buffer, long *bytes) override |
| void | copy_time_sigs_to (Alg_seq *dest) |
| a utility function | |
| void | set_time_map (Alg_time_map *map) override |
| void | unserialize_seq () |
| void | write (std::ostream &file, bool in_secs, double offset=0.0) |
| write an ascii representation to file | |
| bool | write (const char *filename, double offset=0.0) |
| returns true on success | |
| void | smf_write (std::ostream &file) |
| bool | smf_write (const char *filename) |
| int | tracks () |
| Returns the number of tracks. | |
| void | add_track (int track_num) |
| create a track | |
| Alg_track_ptr | track (int) |
| Alg_event_ptr & | operator[] (int i) override |
| void | convert_to_seconds () override |
| void | convert_to_beats () override |
| Change units. | |
| Alg_track_ptr | cut_from_track (int track_num, double start, double dur, bool all) |
| Alg_seq * | cut (double t, double len, bool all) override |
| void | insert_silence_in_track (int track_num, double t, double len) |
| void | insert_silence (double t, double len) override |
| Alg_track_ptr | copy_track (int track_num, double t, double len, bool all) |
| Alg_seq * | copy (double start, double len, bool all) override |
| void | paste (double start, Alg_seq *seq) |
| void | clear (double t, double len, bool all) override |
| void | merge (double t, Alg_event_list_ptr seq) override |
| void | silence (double t, double len, bool all) override |
| void | clear_track (int track_num, double start, double len, bool all) |
| void | silence_track (int track_num, double start, double len, bool all) |
| Alg_event_list_ptr | find_in_track (int track_num, double t, double len, bool all, long channel_mask, long event_type_mask) |
| long | seek_time (double time, int track_num) |
| find index of first score event after time | |
| bool | insert_beat (double time, double beat) |
| double | nearest_beat_time (double time, double *beat) |
| bool | insert_tempo (double bpm, double beat) |
| warning: insert_tempo may change representation from seconds to beats | |
| bool | stretch_region (double b0, double b1, double dur) |
| void | add_event (Alg_event_ptr event, int track_num) |
| void | add (Alg_event_ptr) override |
| double | get_tempo (double beat) |
| get the tempo starting at beat | |
| bool | set_tempo (double bpm, double start_beat, double end_beat) |
| double | get_bar_len (double beat) |
| get the bar length in beats starting at beat | |
| void | set_time_sig (double beat, double num, double den) |
| void | beat_to_measure (double beat, long *measure, double *m_beat, double *num, double *den) |
| void | merge_tracks () |
| void set_events(Alg_event_ptr *events, long len, long max); | |
| void | set_in_use (bool flag) override |
| set in_use flag on all tracks | |
| Public Member Functions inherited from Alg_track | |
| void | serialize_track () |
| void | unserialize_track () |
| Alg_event_ptr & | operator[] (int i) override |
| Alg_track () | |
| Alg_track (Alg_time_map *map, bool seconds) | |
| initialize empty track with a time map | |
| Alg_event_ptr | copy_event (Alg_event_ptr event) |
| make a complete copy | |
| Alg_track (Alg_track &track) | |
| Alg_track (Alg_event_list_ref event_list, Alg_time_map_ptr map, bool units_are_seconds) | |
| copy constructor: event_list is copied, map is installed and referenced | |
| ~Alg_track () override | |
| Alg_seq_ptr | to_alg_seq () |
| bool | get_units_are_seconds () |
| Are we using beats or seconds? | |
| void | set_dur (double dur) |
| double | get_dur () |
| Alg_time_map * | get_time_map () |
| Alg_note * | create_note (double time, int channel, int identifier, float pitch, float loudness, double duration) |
| Alg_update * | create_update (double time, int channel, int identifier) |
| virtual void | add (Alg_event *event) |
| void | paste (double t, Alg_event_list *seq) |
| virtual Alg_event_list * | find (double t, double len, bool all, long channel_mask, long event_type_mask) |
| Public Member Functions inherited from Alg_event_list | |
| Alg_event_list () | |
| Alg_event_list (Alg_track *owner) | |
| char | get_type () |
| Alg_track * | get_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_ptr & | operator[] (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) |
Public Attributes | |
| int | channel_offset_per_track |
| used to encode track_num into channel | |
| Alg_tracks | track_list |
| array of Alg_events | |
| Alg_time_sigs | time_sig |
| int | beat_x |
| Public Attributes inherited from Alg_events | |
| double | last_note_off |
| bool | in_use |
Protected Member Functions | |
| void | serialize_seq () |
| Alg_event_ptr | write_track_name (std::ostream &file, int n, Alg_events &events) |
| an internal function used for writing Allegro track names | |
| Protected Member Functions inherited from Alg_track | |
| char * | get_string (char **p, long *b) |
| long | get_int32 (char **p, long *b) |
| double | get_double (char **p, long *b) |
| float | get_float (char **p, long *b) |
| void | serialize_parameter (Alg_parameter *parm) |
| void | unserialize_parameter (Alg_parameter_ptr parm_ptr) |
Protected Attributes | |
| Alg_iterator_ptr | pending |
| iterator used internally by Alg_seq methods | |
| Alg_error | error |
| Protected Attributes inherited from Alg_track | |
| Alg_time_map * | time_map |
| bool | units_are_seconds |
| Protected Attributes inherited from Alg_event_list | |
| char | type |
| 'e' Alg_event_list, 't' Alg_track, 's' Alg_seq | |
| Alg_track * | events_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_ptr * | events |
| events is array of pointers | |
Additional Inherited Members | |
| Static Public Member Functions inherited from Alg_track | |
| static Alg_track * | unserialize (void *buffer, long len) |
| Static Protected Attributes inherited from Alg_track | |
| static Serial_read_buffer | ser_read_buf |
| static Serial_write_buffer | ser_write_buf |
| Static Protected Attributes inherited from Alg_event_list | |
| static const char * | last_error_message |
| static int | sequences |
| to keep track of sequence numbers | |
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
see Alg_seq::Alg_seq() constructors that read from files the following are for internal library implementation and are moved to *_internal.h header files. Alg_seq_ptr alg_read(std::istream &file, Alg_seq_ptr new_seq); Alg_seq_ptr alg_smf_read(std::istream &file, Alg_seq_ptr new_seq);
|
inline |
|
inline |
|
inline |
| Alg_seq::Alg_seq | ( | std::istream & | file, |
| bool | smf, | ||
| double * | offset_ptr = nullptr ) |
create from file:
create from filename
|
override |
|
inlineoverride |
call add_event instead
| void Alg_seq::add_event | ( | Alg_event_ptr | event, |
| int | track_num ) |
add_event takes a pointer to an event on the heap. The event is not copied, and this Alg_seq becomes the owner and freer of the event.
|
inline |
| void Alg_seq::beat_to_measure | ( | double | beat, |
| long * | measure, | ||
| double * | m_beat, | ||
| double * | num, | ||
| double * | den ) |
|
overridevirtual |
Deletes and shifts notes to fill the gap. The tempo track is also modified accordingly. ONLY EVENTS THAT START WITHIN THE REGION ARE DELETED unless "all" is true, in which case all notes that intersect the region are cleared. NOTES THAT EXTEND FROM BEFORE THE REGION INTO THE REGION RETAIN THEIR DURATION IN EITHER BEATS OR SECONDS ACCORDING TO THE CURRENT UNITS OF this.
Reimplemented from Alg_track.
|
overridevirtual |
Like cut() but doesn't remove the notes from the original sequence. The Alg_events are copied, not shared. ONLY EVENTS THAT START WITHIN THE REGION ARE COPIED unless "all" is true in which case all notes that intersect the region are copied. COPIED NOTES MAY EXTEND BEYOND THE DURATION OF THE RESULTING SEQ. The return type is the same as this (may be Alg_seq).
Reimplemented from Alg_track.
| Alg_track_ptr Alg_seq::copy_track | ( | int | track_num, |
| double | t, | ||
| double | len, | ||
| bool | all ) |
|
overridevirtual |
Deletes the notes that start within the given region and returns them in a new sequence. The start times of the notes in the returned sequence are shifted by -t. The notes after the region get shifted over to fill the gap. In an Alg_seq, the tempo track is edited in a similar way and the cut tempo information is retained in the new seq. ONLY NOTES THAT START WITHIN THE REGION ARE CUT unless "all" is true in which case all notes that intersect the region are copied. CUT NOTES MAY EXTEND BEYOND THE DURATION OF THE RESULTING SEQ. The return type is the same as this (may be Alg_seq). All times including len are interpreted according to units_are_seconds in the track.
Reimplemented from Alg_track.
| Alg_track_ptr Alg_seq::cut_from_track | ( | int | track_num, |
| double | start, | ||
| double | dur, | ||
| bool | all ) |
| Alg_event_list_ptr Alg_seq::find_in_track | ( | int | track_num, |
| double | t, | ||
| double | len, | ||
| bool | all, | ||
| long | channel_mask, | ||
| long | event_type_mask ) |
| double Alg_seq::get_bar_len | ( | double | beat | ) |
get the bar length in beats starting at beat
|
inline |
| double Alg_seq::get_tempo | ( | double | beat | ) |
get the tempo starting at beat
| bool Alg_seq::insert_beat | ( | double | time, |
| double | beat ) |
|
overridevirtual |
Simply shifts notes past time t over by len, which is given in either beats or seconds according to the units of this. The resulting interveal (t, t+len) may in fact contain notes that begin before t. The durations of notes are not changed. If this is an Alg_seq, the tempo track is expanded at t also.
Reimplemented from Alg_track.
| bool Alg_seq::insert_tempo | ( | double | bpm, |
| double | beat ) |
warning: insert_tempo may change representation from seconds to beats
|
overridevirtual |
Merges two sequences with a certain offset. The offset is interpreted as either beats or seconds according to the current units of this, and seq is converted to the same units as this. Except for a possible conversion to beats or seconds, the tempo track of seq (if any) is ignored. (There is no way to merge tempo tracks.) THE SEQ PARAMETER IS NOT MODIFIED, AND Alg_event's ARE COPIED, NOT SHARED. The type of seq must be Alg_seq if seq is an Alg_seq, or Alg_track if seq is an Alg_track or an Alg_event_list.
Reimplemented from Alg_track.
| void Alg_seq::merge_tracks | ( | ) |
void set_events(Alg_event_ptr *events, long len, long max);
move all track data into one track
| double Alg_seq::nearest_beat_time | ( | double | time, |
| double * | beat ) |
return the time of the beat nearest to time, also returns beat number through beat. This will correspond to an integer number of beats from the nearest previous time signature or 0.0, but since time signatures need not be on integer beat boundaries the beat location may not be on an integer beat (beat locations are measured from the beginning which is beat 0.
|
overridevirtual |
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 from Alg_event_list.
| long Alg_seq::seek_time | ( | double | time, |
| int | track_num ) |
find index of first score event after time
| void Alg_seq::seq_from_track | ( | Alg_track_ref | tr | ) |
Returns a buffer containing a serialization of the file. It will be an ASCII representation unless text is true. *buffer gets a newly allocated buffer pointer. The caller must free it. *len gets the length of the serialized track
Reimplemented from Alg_track.
|
protected |
|
overridevirtual |
set in_use flag on all tracks
Reimplemented from Alg_track.
| bool Alg_seq::set_tempo | ( | double | bpm, |
| double | start_beat, | ||
| double | end_beat ) |
|
overridevirtual |
Every Alg_track may have an associated time_map. If no map is specified, or if you set_time_map(nullptr), then the behavior should be as if there is a constant tempo of 100 beats/minute (this constant is determined by ALG_DEFAULT_BPM). Recommendation: create a static global tempo map object. When any operation that needs a tempo map gets nullptr, use the global tempo map. (Exception: any operation that would modify the tempo map should raise an error – you don't want to change the default tempo map.)
Reimplemented from Alg_track.
| void Alg_seq::set_time_sig | ( | double | beat, |
| double | num, | ||
| double | den ) |
|
overridevirtual |
Deletes notes but doesn't shift. If the "all" argument is true, deletes all notes that intersect the range at all, not just those that start within it. The tempo track is not affected.
Reimplemented from Alg_track.
| bool Alg_seq::smf_write | ( | const char * | filename | ) |
| void Alg_seq::smf_write | ( | std::ostream & | file | ) |
| bool Alg_seq::stretch_region | ( | double | b0, |
| double | b1, | ||
| double | dur ) |
change the duration from b0 to b1 (beats) to dur (seconds) by scaling the intervening tempos
| Alg_track_ptr Alg_seq::track | ( | int | i | ) |
Return a particular track. This Alg_seq owns the track, so the caller must not delete the result.
| int Alg_seq::tracks | ( | ) |
Returns the number of tracks.
| void Alg_seq::unserialize_seq | ( | ) |
encode sequence structure into contiguous, moveable memory block address of newly allocated memory is assigned to *buffer, which must be freed by caller; the length of data is assigned to *len
| bool Alg_seq::write | ( | const char * | filename, |
| double | offset = 0.0 ) |
returns true on success
| void Alg_seq::write | ( | std::ostream & | file, |
| bool | in_secs, | ||
| double | offset = 0.0 ) |
write an ascii representation to file
|
protected |
an internal function used for writing Allegro track names
| int Alg_seq::beat_x |
| int Alg_seq::channel_offset_per_track |
used to encode track_num into channel
|
protected |
error code set by file readers
|
protected |
iterator used internally by Alg_seq methods
| Alg_time_sigs Alg_seq::time_sig |
| Alg_tracks Alg_seq::track_list |
array of Alg_events