feat: StepDetector update FPS, more FPS fixes

This commit is contained in:
2026-05-20 00:57:49 +02:00
parent f591f4950f
commit 60a5b109bb
6 changed files with 40 additions and 19 deletions

View File

@@ -33,8 +33,8 @@ public:
*/
class SsfStepDetector {
protected:
const size_t LEN_INIT;
const size_t LEN_TH_WIN;
size_t LEN_INIT;
size_t LEN_TH_WIN;
size_t num_samples;
double ssf_threshold;
double ssf_threshold_nm1;
@@ -50,6 +50,7 @@ public:
* @param len_refr duration of refractory period, in samples
*/
SsfStepDetector(double fps);
~SsfStepDetector();
double filter(double val);
double peek_threshold();
@@ -62,18 +63,19 @@ public:
class RunningQuality {
protected:
// TODO: make it a filter (output proper samples)
// TODO: use fps info
/** template beat is resampled to this #samples */
const int BEAT_LEN = 120 /* 2*FPS for 30 bpm lower end */;
int BEAT_LEN;
/** threshold for accepting initial beats */
const double BEAT_CORR_THR_1 = 0.9;
double BEAT_CORR_THR_1 = 0.9;
/** threshold for accepting subsequent beats */
const double BEAT_CORR_THR_2 = 0.8;
double BEAT_CORR_THR_2 = 0.8;
/** absolute SSF threshold for accepting any beat */
const double SSF_THRESHOLD = 5.0;
double SSF_THRESHOLD = 5.0;
/** number of recent beats to use for beat template. must be even (alternating feet have different patterns; make it symmetric) */
const int NUM_BEATS = 4;
int NUM_BEATS = 4;
std::deque<std::vector<double> > beatTemplates;
std::vector<double> beatTemplate;
@@ -93,8 +95,8 @@ protected:
virtual void dispatchBeat(int idx, bool good, double posCorr);
public:
RunningQuality();
explicit RunningQuality(bool disableSsf);
RunningQuality(double fps);
explicit RunningQuality(double fps, bool disableSsf);
virtual ~RunningQuality();
// note: arg should be an iterator really, but can do later
@@ -116,6 +118,7 @@ protected:
double sqi;
public:
RunningQualityFilter(double fps);
~RunningQualityFilter();
double filter(double y, double ssf, double step);
};

View File

@@ -51,6 +51,7 @@ protected:
Resampler res_x;
Resampler res_y;
Resampler res_z;
double fps;
public:
StepDetector(double fps, StepListener *listener, bool debug = false);