feat: check SQI before playing step sound

This commit is contained in:
2026-03-12 22:20:00 +01:00
parent a2fdf05cd5
commit a8234005df
3 changed files with 7 additions and 3 deletions

View File

@@ -24,7 +24,8 @@ StepDetector::StepDetector(StepListener *listener) :
f_highpass(hpf_taps_b, hpf_taps_a),
f_neg(1, 0, 0, std::vector {-1.0}),
f_ssf(upslope_width),
f_ssd(len_refr)
f_ssd(len_refr),
f_sqi(upslope_width)
{}
#if (FPS != 60)
@@ -38,7 +39,9 @@ void StepDetector::filter(std::vector<float> values) {
auto s2 = f_neg.filter(s1);
auto s3 = f_ssf.filter(s2);
auto s4 = f_ssd.filter(s3);
if(s4 > 0.0 && listener != nullptr) {
auto q5 = f_sqi.filter(s2, s3, s4);
// is step, step quality is OK, and we have a listener?
if(s4 > 0.0 && q5 > 0.0 && listener != nullptr) {
listener->playBeat();
}
}

View File

@@ -17,6 +17,7 @@ protected:
Filt f_neg;
SsfFilter f_ssf;
SsfStepDetector f_ssd;
RunningQualityFilter f_sqi;
public:
StepDetector(StepListener *listener);