Tempo Tapper
1.0.0
A simple library to implement a tempo tapper
|
Go to the documentation of this file.
42 #define S_TO_US 1000000
44 #if defined(TT_TARGET_PLATFORM_POSIX)
47 typedef struct timeval tt_time_t;
49 #elif defined(TT_TARGET_PLATFORM_ARDUINO)
52 typedef unsigned long tt_time_t;
56 #error No target platform specified!
117 void add_time(tt_time_t *a, tt_time_t *b, tt_time_t *res);
127 void sub_time(tt_time_t *a, tt_time_t *b, tt_time_t *res);
void reset_time(tt_time_t *time)
Resets a time var to 0.
unsigned long tt_period_us(tempo_tapper *tapper)
Returns the period of a tempo in microseconds.
void add_time(tt_time_t *a, tt_time_t *b, tt_time_t *res)
Adds two time values.
void tt_tap(tempo_tapper *tapper)
"Taps" the tempo tapper
tt_time_t prd_sum
Holds the sum of all measured/"tapped" periods.
tt_time_t lst_t
Hold the clock time of the last tap.
tempo_tapper * tt_new()
Creates a new tempo tapper instance.
BPM_t tt_bpm(tempo_tapper *tapper)
Returns the tempo in BPM.
void tt_reset(tempo_tapper *tapper)
Resets the tempo tapper.
int taps
Number of taps. The inital val is -1, meaning the 1st tap does not count.
struct tempo_tapper tempo_tapper
Tempo tapper struct.
void sub_time(tt_time_t *a, tt_time_t *b, tt_time_t *res)
Subtracts two time values.
unsigned long time_to_us(tt_time_t *time)
Returns a time value in microseconds.
void current_time(tt_time_t *time)
Receives the current clock time.