ardour
Functions
smf_tempo.c File Reference
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <string.h>
#include "smf.h"
#include "smf_private.h"

Go to the source code of this file.

Functions

static double seconds_from_pulses (const smf_t *smf, size_t pulses)
 
static smf_tempo_tnew_tempo (smf_t *smf, size_t pulses)
 
static int add_tempo (smf_t *smf, int pulses, int tempo)
 
static int add_time_signature (smf_t *smf, int pulses, int numerator, int denominator, int clocks_per_click, int notes_per_note)
 
void maybe_add_to_tempo_map (smf_event_t *event)
 
void remove_last_tempo_with_pulses (smf_t *smf, size_t pulses)
 
static int pulses_from_seconds (const smf_t *smf, double seconds)
 
void smf_create_tempo_map_and_compute_seconds (smf_t *smf)
 
smf_tempo_tsmf_get_tempo_by_number (const smf_t *smf, size_t number)
 
smf_tempo_tsmf_get_tempo_by_pulses (const smf_t *smf, size_t pulses)
 
smf_tempo_tsmf_get_tempo_by_seconds (const smf_t *smf, double seconds)
 
smf_tempo_tsmf_get_last_tempo (const smf_t *smf)
 
void smf_fini_tempo (smf_t *smf)
 
void smf_init_tempo (smf_t *smf)
 
static int last_event_pulses (const smf_track_t *track)
 
void smf_track_add_event_delta_pulses (smf_track_t *track, smf_event_t *event, uint32_t delta)
 
void smf_track_add_event_pulses (smf_track_t *track, smf_event_t *event, size_t pulses)
 
void smf_track_add_event_seconds (smf_track_t *track, smf_event_t *event, double seconds)
 

Detailed Description

Tempo map related part.

Definition in file smf_tempo.c.

Function Documentation

static int add_tempo ( smf_t smf,
int  pulses,
int  tempo 
)
static

Definition at line 95 of file smf_tempo.c.

static int add_time_signature ( smf_t smf,
int  pulses,
int  numerator,
int  denominator,
int  clocks_per_click,
int  notes_per_note 
)
static

Definition at line 107 of file smf_tempo.c.

static int last_event_pulses ( const smf_track_t track)
static

Returns ->time_pulses of last event on the given track, or 0, if track is empty.

Definition at line 380 of file smf_tempo.c.

void maybe_add_to_tempo_map ( smf_event_t event)

Definition at line 125 of file smf_tempo.c.

static smf_tempo_t* new_tempo ( smf_t smf,
size_t  pulses 
)
static

If there is tempo starting at "pulses" already, return it. Otherwise, allocate new one, fill it with values from previous one (or default ones, if there is no previous one) and attach it to "smf".

Definition at line 50 of file smf_tempo.c.

static int pulses_from_seconds ( const smf_t smf,
double  seconds 
)
static

Definition at line 213 of file smf_tempo.c.

void remove_last_tempo_with_pulses ( smf_t smf,
size_t  pulses 
)

Definition at line 173 of file smf_tempo.c.

static double seconds_from_pulses ( const smf_t smf,
size_t  pulses 
)
static

Definition at line 197 of file smf_tempo.c.

void smf_create_tempo_map_and_compute_seconds ( smf_t smf)

Definition at line 235 of file smf_tempo.c.

void smf_fini_tempo ( smf_t smf)

Definition at line 339 of file smf_tempo.c.

smf_tempo_t* smf_get_last_tempo ( const smf_t smf)

Return last tempo.

Definition at line 322 of file smf_tempo.c.

smf_tempo_t* smf_get_tempo_by_number ( const smf_t smf,
size_t  number 
)

Definition at line 257 of file smf_tempo.c.

smf_tempo_t* smf_get_tempo_by_pulses ( const smf_t smf,
size_t  pulses 
)

Return last tempo (i.e. tempo with greatest time_pulses) that happens before "pulses".

Definition at line 269 of file smf_tempo.c.

smf_tempo_t* smf_get_tempo_by_seconds ( const smf_t smf,
double  seconds 
)

Return last tempo (i.e. tempo with greatest time_seconds) that happens before "seconds".

Definition at line 294 of file smf_tempo.c.

void smf_init_tempo ( smf_t smf)

Definition at line 364 of file smf_tempo.c.

void smf_track_add_event_delta_pulses ( smf_track_t track,
smf_event_t event,
uint32_t  delta 
)

Adds event to the track at the time "pulses" clocks from the previous event in this track. The remaining two time fields will be computed automatically based on the third argument and current tempo map. Note that ->delta_pulses is computed by smf.c:smf_track_add_event, not here.

Definition at line 400 of file smf_tempo.c.

void smf_track_add_event_pulses ( smf_track_t track,
smf_event_t event,
size_t  pulses 
)

Adds event to the track at the time "pulses" clocks from the start of song. The remaining two time fields will be computed automatically based on the third argument and current tempo map.

Definition at line 418 of file smf_tempo.c.

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. The remaining two time fields will be computed automatically based on the third argument and current tempo map.

Definition at line 434 of file smf_tempo.c.