29 mStats.currentFloor = 100.0f;
32 mStats.samplesProcessed = 0;
33 mStats.inHysteresis =
false;
42 float combinedLevel =
combineDomains(timedomainLevel, frequencydomainLevel);
45 if (
mStats.samplesProcessed == 0) {
46 mStats.minObserved = combinedLevel;
47 mStats.maxObserved = combinedLevel;
68 return fl::max(0.0f, normalized);
86 const float decayAlpha =
mConfig.decayRate;
90 mStats.inHysteresis =
false;
100 const float attackAlpha = 1.0f -
mConfig.attackRate;
104 mStats.inHysteresis =
false;
109 mStats.inHysteresis =
true;
119 if (freqLevel < 0.0f) {
124 const float w =
mConfig.crossDomainWeight;
125 return (1.0f - w) * timeLevel + w * freqLevel;
float normalize(float level) const FL_NOEXCEPT
Normalize signal by removing noise floor.
bool isAboveFloor(float level) const FL_NOEXCEPT
Check if signal is above noise floor + margin.
float mCurrentFloor
Current noise floor estimate.
void update(float timedomainLevel, float frequencydomainLevel=-1.0f) FL_NOEXCEPT
Update noise floor estimate with new observation.
void updateFloor(float level) FL_NOEXCEPT
Update floor estimate based on current observation.
NoiseFloorTrackerConfig mConfig
void configure(const NoiseFloorTrackerConfig &config) FL_NOEXCEPT
Configure the noise floor tracker.
void reset() FL_NOEXCEPT
Reset noise floor to initial state.
float mLastHysteresisFloor
Floor value at last hysteresis trigger Used to enforce hysteresis margin before allowing floor to ris...
float combineDomains(float timeLevel, float freqLevel) const FL_NOEXCEPT
Calculate combined metric from time and frequency domains.
~NoiseFloorTracker() FL_NOEXCEPT
u32 mBelowFloorCount
Count of consecutive samples below floor (for slow attack)
NoiseFloorTracker() FL_NOEXCEPT
Configuration for noise floor tracking.
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
Base definition for an LED controller.