Added scheduling
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user