adding various improvements to the experience

This commit is contained in:
Joren de Graaf
2026-10-10 00:34:14 +02:00
parent 9ec360d736
commit 7f5ef0b61b
9 changed files with 250 additions and 71 deletions
+10 -7
View File
@@ -1,6 +1,8 @@
#pragma once
#include <Arduino.h>
#include "boomcast_queue.h"
#include "boomcast_config.h"
#include "boomcast_detector.h"
class BoomAudio {
public:
@@ -22,20 +24,21 @@ private:
uint32_t droppedSamples_ = 0;
uint32_t recordingErrors_ = 0;
bool capturing_ = false;
uint32_t lastTriggerMs_ = 0;
uint32_t startedMs_ = 0;
float noiseRms_ = 500.0f;
float noisePeak_ = 3000.0f;
BoomDetector detector_{AUDIO_SAMPLE_RATE,
(AUDIO_SAMPLE_RATE + DETECTION_WINDOWS_PER_SECOND / 2) / DETECTION_WINDOWS_PER_SECOND,
AUDIO_SAMPLE_RATE * POST_EVENT_MS / 1000,
DETECTION_WARMUP_SAMPLES, DETECTION_COOLDOWN_SAMPLES,
DETECTION_INITIAL_BASELINE, DETECTION_BASELINE_ALPHA, DETECTION_BASELINE_CLAMP,
DETECTION_RMS_FLOOR, DETECTION_RMS_MULTIPLIER, DETECTION_PEAK_FLOOR};
volatile uint8_t sensitivity_ = 55;
static void taskThunk(void* arg);
void taskLoop();
void processMonoBlock(const int16_t* mono, size_t frames);
void pushRing(const int16_t* mono, size_t frames);
void beginCapture(const int16_t* current, size_t frames);
void appendCapture(const int16_t* mono, size_t frames);
void beginCapture();
void appendCapture(int16_t sample);
void finishCapture();
bool shouldTrigger(float rms, int32_t peak) const;
void updateWaveform(const int16_t* mono, size_t frames);
};