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