223#if defined(__GNUC__) && __GNUC__ >= 4
224#define WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
226#define WARN_UNUSED_RESULT
smf_tempo_t * smf_get_last_tempo(const smf_t *smf) WARN_UNUSED_RESULT
Return last tempo.
smf_tempo_t * smf_get_tempo_by_seconds(const smf_t *smf, double seconds) WARN_UNUSED_RESULT
Return last tempo (i.e.
void smf_event_remove_from_track(smf_event_t *event)
Detaches event from its track.
smf_event_t * smf_event_new_from_pointer(void *midi_data, int len) WARN_UNUSED_RESULT
Allocates an smf_event_t structure and fills it with "len" bytes copied from "midi_data".
void smf_delete(smf_t *smf)
Frees smf and all it's descendant structures.
void smf_track_add_event_pulses(smf_track_t *track, smf_event_t *event, int pulses)
Adds event to the track at the time "pulses" clocks from the start of song.
smf_t * smf_new(void) WARN_UNUSED_RESULT
Allocates new smf_t structure.
char * smf_event_decode(const smf_event_t *event) WARN_UNUSED_RESULT
int smf_event_is_system_common(const smf_event_t *event) WARN_UNUSED_RESULT
int smf_seek_to_pulses(smf_t *smf, int pulses) WARN_UNUSED_RESULT
Seeks the SMF to the given position.
int smf_event_is_textual(const smf_event_t *event) WARN_UNUSED_RESULT
int smf_set_format(smf_t *smf, int format) WARN_UNUSED_RESULT
Sets "Format" field of MThd header to the specified value.
smf_event_t * smf_event_new(void) WARN_UNUSED_RESULT
Allocates new smf_event_t structure.
int smf_seek_to_seconds(smf_t *smf, double seconds) WARN_UNUSED_RESULT
Seeks the SMF to the given position.
smf_event_t * smf_track_get_last_event(const smf_track_t *track) WARN_UNUSED_RESULT
smf_t * smf_load_from_memory(const void *buffer, const int buffer_length) WARN_UNUSED_RESULT
Creates new SMF and fills it with data loaded from the given buffer.
int smf_event_is_metadata(const smf_event_t *event) WARN_UNUSED_RESULT
int smf_event_is_sysex(const smf_event_t *event) WARN_UNUSED_RESULT
int smf_set_ppqn(smf_t *smf, int format) WARN_UNUSED_RESULT
Sets the PPQN ("Division") field of MThd header.
void smf_add_track(smf_t *smf, smf_track_t *track)
Appends smf_track_t to smf.
int smf_save(smf_t *smf, const char *file_name) WARN_UNUSED_RESULT
Writes the contents of SMF to the file given.
void smf_track_delete(smf_track_t *track)
Detaches track from its smf and frees it.
int smf_event_is_eot(const smf_event_t *event) WARN_UNUSED_RESULT
smf_track_t * smf_track_new(void) WARN_UNUSED_RESULT
Allocates new smf_track_t structure.
int smf_track_add_eot_delta_pulses(smf_track_t *track, int delta) WARN_UNUSED_RESULT
Add End Of Track metaevent.
void smf_skip_next_event(smf_t *smf)
Advance the "next event counter".
const char * smf_get_version(void) WARN_UNUSED_RESULT
int smf_get_length_pulses(const smf_t *smf) WARN_UNUSED_RESULT
void smf_rewind(smf_t *smf)
Rewinds the SMF.
int smf_track_add_eot_seconds(smf_track_t *track, double seconds) WARN_UNUSED_RESULT
void smf_track_add_event_delta_pulses(smf_track_t *track, smf_event_t *event, int pulses)
Adds event to the track at the time "pulses" clocks from the previous event in this track.
char * smf_decode(const smf_t *smf) WARN_UNUSED_RESULT
smf_event_t * smf_get_next_event(smf_t *smf) WARN_UNUSED_RESULT
smf_event_t * smf_event_new_textual(int type, const char *text)
smf_track_t * smf_get_track_by_number(const smf_t *smf, int track_number) WARN_UNUSED_RESULT
smf_tempo_t * smf_get_tempo_by_pulses(const smf_t *smf, int pulses) WARN_UNUSED_RESULT
Return last tempo (i.e.
void smf_event_delete(smf_event_t *event)
Detaches event from its track and frees it.
void smf_track_remove_from_smf(smf_track_t *track)
Detaches track from the smf.
char * smf_event_extract_text(const smf_event_t *event) WARN_UNUSED_RESULT
Extracts text from "textual metaevents", such as Text or Lyric.
double smf_get_length_seconds(const smf_t *smf) WARN_UNUSED_RESULT
int smf_event_is_valid(const smf_event_t *event) WARN_UNUSED_RESULT
smf_event_t * smf_peek_next_event(smf_t *smf) WARN_UNUSED_RESULT
void smf_track_add_event_seconds(smf_track_t *track, smf_event_t *event, double seconds)
Adds event to the track at the time "seconds" seconds from the start of song.
int smf_seek_to_event(smf_t *smf, const smf_event_t *event) WARN_UNUSED_RESULT
Seeks the SMF to the given event.
int smf_event_is_system_realtime(const smf_event_t *event) WARN_UNUSED_RESULT
smf_event_t * smf_event_new_from_bytes(int first_byte, int second_byte, int third_byte) WARN_UNUSED_RESULT
Allocates an smf_event_t structure and fills it with at most three bytes of data.
smf_t * smf_load(const char *file_name) WARN_UNUSED_RESULT
Loads SMF file.
int smf_event_is_last(const smf_event_t *event) WARN_UNUSED_RESULT
smf_tempo_t * smf_get_tempo_by_number(const smf_t *smf, int number) WARN_UNUSED_RESULT
int smf_track_add_eot_pulses(smf_track_t *track, int pulses) WARN_UNUSED_RESULT
smf_event_t * smf_track_get_event_by_number(const smf_track_t *track, int event_number) WARN_UNUSED_RESULT
smf_event_t * smf_track_get_next_event(smf_track_t *track) WARN_UNUSED_RESULT
Returns next event from the track given and advances next event counter.
Represents a single MIDI event or metaevent.
int time_pulses
Time, in pulses, since the start of the song.
int event_number
Number of this event in the track.
unsigned char * midi_buffer
Pointer to the buffer containing MIDI message.
double time_seconds
Time, in seconds, since the start of the song.
void * user_pointer
API consumer is free to use this for whatever purpose.
int track_number
Tracks are numbered consecutively, starting from 1.
int midi_buffer_length
Length of the MIDI message in the buffer, in bytes.
int delta_time_pulses
Note that the time fields are invalid, if event is not attached to a track.
smf_track_t * track
Pointer to the track, or NULL if event is not attached.
Represents a "song", that is, collection of one or more tracks.
GPtrArray * tracks_array
Private, used by smf.c.
FILE * stream
These are private fields using only by loading and saving routines.
GPtrArray * tempo_array
Private, used by smf_tempo.c.
double last_seek_position
int ppqn
These fields are extracted from "division" field of MThd header.
int expected_number_of_tracks
Describes a single tempo or time signature change.
int microseconds_per_quarter_note
Represents a single track.
int time_of_next_event
Absolute time of next event on events_queue.
int next_event_offset
Private, used by smf.c.
void * file_buffer
These are private fields using only by loading and saving routines.
void * user_pointer
API consumer is free to use this for whatever purpose.