feat: pass fps dynamically

This commit is contained in:
2026-05-19 22:36:24 +02:00
parent d4e0241590
commit 58ed5df87c
10 changed files with 71 additions and 50 deletions

View File

@@ -19,13 +19,13 @@ static std::vector<double> hpf_taps_a {1. , -4.83056552, 9.33652742, -9.
static size_t upslope_width = 4;
const size_t len_refr = (size_t) (FPS / (MAX_BPM / 60));
StepDetector::StepDetector(StepListener *listener, bool debug) :
StepDetector::StepDetector(double fps, StepListener *listener, bool debug) :
listener(listener),
f_highpass(hpf_taps_b, hpf_taps_a),
f_neg(1, 0, 0, std::vector<double> {-1.0}),
f_ssf(upslope_width),
f_ssd(len_refr),
f_sqi(upslope_width),
f_ssf(fps),
f_ssd(fps),
f_sqi(fps),
debug(debug)
{}
@@ -56,8 +56,8 @@ std::vector<double> StepDetector::getBufSsd() { return buf_ssd; }
std::vector<double> StepDetector::getBufSqi() { return buf_sqi; }
std::vector<double> StepDetector::getBufOut() { return buf_out; }
void StepDetector::primeFilters(std::vector<double> sig) {
const size_t N_INIT = SsfStepDetector::initial_samples();
void StepDetector::primeFilters(double fps, std::vector<double> sig) {
const size_t N_INIT = SsfStepDetector::initial_samples(fps);
// initialize: feed for priming the filters
for (size_t i = 0; i < N_INIT; i++) {
const auto a_i = static_cast<float>(sig[i]);