feat(transport): set project tempo by tapping a pulse (phase 97)
This commit is contained in:
parent
7ad85b6144
commit
b7a4a1acd4
9 changed files with 92 additions and 5 deletions
18
include/xtc/xtc_tempo.h
Normal file
18
include/xtc/xtc_tempo.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef XTC_TEMPO_H
|
||||
#define XTC_TEMPO_H
|
||||
#include "xtc_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Control-thread estimator, four rolling intervals, 20..300 BPM. Zero initialize
|
||||
* or reset before use. Caller supplies monotonic seconds; no clock or I/O here. */
|
||||
typedef struct {double last,intervals[4];unsigned int count,head,started;} xtc_tap_tempo;
|
||||
void xtc_tap_tempo_reset(xtc_tap_tempo *state);
|
||||
/* First tap or gap >3s primes/restarts and returns NOT_FOUND without changing
|
||||
* out. Invalid arguments/too-fast/backward timestamps preserve state and out.
|
||||
* Success returns rounded milli-BPM and updates state. */
|
||||
xtc_result xtc_tap_tempo_push(xtc_tap_tempo *state,double seconds,unsigned int *out);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue