Make microphone slot discovery self-healing
The ES7210 power-up transient is loud enough to look like the first sound. It placed one centred blip right after init and then pinned the mic pair to whichever slots were loudest at that instant. If that was the wrong pair, later claps were ignored forever. Ignore the first 800 ms after starting the codec, and re-evaluate the mic pair on every clear sound instead of locking once. The pair only changes after repeating for a few blocks, or immediately when the current pair is silent while another one is loud. Also enable the per-second rms/pair debug line so the slot mapping can be verified on hardware.
This commit is contained in:
@@ -56,10 +56,11 @@ private:
|
||||
float floorR_ = 0.01f;
|
||||
|
||||
// The codec always delivers four TDM slots, but only two microphones are
|
||||
// fitted. These are discovered at runtime from whichever slots carry the
|
||||
// most signal.
|
||||
// fitted. The pair is (re)discovered from the slots that carry signal.
|
||||
int leftSlot_ = 0;
|
||||
int rightSlot_ = 1;
|
||||
bool pairLocked_ = false;
|
||||
float slotScore_[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
int candL_ = -1;
|
||||
int candR_ = -1;
|
||||
int candCount_ = 0;
|
||||
uint32_t warmupUntil_ = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user