Added scheduling

This commit is contained in:
Joren de Graaf
2026-10-10 16:03:44 +02:00
parent 7f5ef0b61b
commit c35ac005fb
24 changed files with 896 additions and 39 deletions
+8 -1
View File
@@ -7,13 +7,20 @@ int main() {
0.01f, 0.02f, 2.0f, 0.075f, 5.0f, 0.16f);
int16_t sample;
uint64_t frame = 0;
uint64_t listeningStart = 1;
uint64_t captureStart = 0;
while (std::fread(&sample, sizeof(sample), 1, stdin) == 1) {
++frame;
auto result = detector.process(float(sample) / 32768.0f);
if (result == BoomDetector::Result::Trigger) std::printf("T %llu\n", (unsigned long long)frame);
if (result == BoomDetector::Result::Trigger) {
captureStart = frame >= listeningStart + 128000 ? frame - 128000 + 1 : listeningStart;
std::printf("T %llu\n", (unsigned long long)frame);
}
if (result == BoomDetector::Result::TailDone) {
std::printf("S %llu\n", (unsigned long long)captureStart);
std::printf("E %llu\n", (unsigned long long)frame);
detector.reset();
listeningStart = frame + 1;
}
}
std::printf("B %.8f\n", detector.baseline());