M314-style radar: dual-mic blips, sweep reveal, fade lifecycle

This commit is contained in:
Dejvino
2026-11-12 20:04:40 +01:00
parent 315cdbd177
commit 25ad8aa17c
3 changed files with 135 additions and 109 deletions
+4 -5
View File
@@ -17,6 +17,7 @@
struct SoundReading {
float left; // smoothed level above the noise floor (0..1)
float right; // smoothed level above the noise floor (0..1)
float slots[4]; // per-slot smoothed level above the noise floor (0..1)
float balance; // -1 = far left, 0 = centre, +1 = far right
float loudness; // 0 = quiet, 1 = loud (dB-mapped)
bool active; // true while a sound is present (with a short hold)
@@ -45,7 +46,7 @@ private:
void updateSlots(const float *rms);
size_t sampleOffset(int slot) const;
void processBlock(const int16_t *samples, size_t sampleCount);
void publish(float left, float right, float balance, float loudness, bool active);
void publish(float left, float right, const float *slots, float balance, float loudness, bool active);
uint32_t sampleRate_ = 16000;
TaskHandle_t task_ = nullptr;
@@ -56,10 +57,8 @@ private:
SoundReading reading_ = {};
uint32_t lastActiveMs_ = 0;
float envL_ = 0.0f;
float envR_ = 0.0f;
float floorL_ = 0.01f;
float floorR_ = 0.01f;
float env_[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
float floor_[4] = { 0.01f, 0.01f, 0.01f, 0.01f };
// The two TDM slots carrying the populated microphones. Seeded with the
// documented T-Deck pair (MIC1 = slot 0, MIC3 = slot 2) and corrected at