59 return (previous_tempo);
64 g_critical(
"Cannot allocate smf_tempo_t.");
70 if (previous_tempo != NULL) {
98 if (smf_tempo == NULL)
110 if (smf_tempo == NULL)
130 assert(event->
track != NULL);
136 int ntempo = (
event->midi_buffer[3] << 16) + (event->
midi_buffer[4] << 8) +
event->midi_buffer[5];
138 g_critical(
"Ignoring invalid tempo change.");
147 int numerator, denominator, clocks_per_click, notes_per_note;
150 g_critical(
"Time Signature event seems truncated.");
154 numerator =
event->midi_buffer[3];
155 denominator = (int)pow((
double)2,
event->midi_buffer[4]);
156 clocks_per_click =
event->midi_buffer[5];
157 notes_per_note =
event->midi_buffer[6];
299 assert(seconds >= 0.0);
372 g_error(
"tempo_init failed, sorry.");
385 assert(previous_event);
403 assert(track->
smf != NULL);
406 g_critical(
"Added event is invalid");
421 assert(track->
smf != NULL);
423 event->time_pulses = pulses;
436 assert(seconds >= 0.0);
438 assert(track->
smf != NULL);
440 event->time_seconds = seconds;
void smf_rewind(smf_t *smf)
static int add_time_signature(smf_t *smf, int pulses, int numerator, int denominator, int clocks_per_click, int notes_per_note)
void remove_last_tempo_with_pulses(smf_t *smf, size_t pulses)
int smf_event_is_valid(const smf_event_t *event) WARN_UNUSED_RESULT
void smf_track_add_event(smf_track_t *track, smf_event_t *event)
void smf_track_add_event_delta_pulses(smf_track_t *track, smf_event_t *event, uint32_t delta)
smf_tempo_t * smf_get_tempo_by_pulses(const smf_t *smf, size_t pulses)
static int pulses_from_seconds(const smf_t *smf, double seconds)
size_t midi_buffer_length
int smf_event_is_metadata(const smf_event_t *event) WARN_UNUSED_RESULT
void smf_track_add_event_seconds(smf_track_t *track, smf_event_t *event, double seconds)
static int last_event_pulses(const smf_track_t *track)
static double seconds_from_pulses(const smf_t *smf, size_t pulses)
void smf_init_tempo(smf_t *smf)
void smf_create_tempo_map_and_compute_seconds(smf_t *smf)
void maybe_add_to_tempo_map(smf_event_t *event)
smf_tempo_t * smf_get_last_tempo(const smf_t *smf)
static smf_tempo_t * new_tempo(smf_t *smf, size_t pulses)
void smf_track_add_event_pulses(smf_track_t *track, smf_event_t *event, size_t pulses)
static int add_tempo(smf_t *smf, int pulses, int tempo)
void smf_fini_tempo(smf_t *smf)
int microseconds_per_quarter_note
smf_tempo_t * smf_get_tempo_by_number(const smf_t *smf, size_t number)
smf_event_t * smf_track_get_last_event(const smf_track_t *track)
smf_tempo_t * smf_get_tempo_by_seconds(const smf_t *smf, double seconds)
smf_event_t * smf_get_next_event(smf_t *smf)