FastLED 3.9.15
Loading...
Searching...
No Matches

◆ shouldChangeMood()

bool fl::audio::detector::MoodAnalyzer::shouldChangeMood ( const Mood & newMood)
private

Definition at line 219 of file mood_analyzer.cpp.hpp.

219 {
220 // Check if mood category has changed
221 if (mPreviousMood.getCategory() == newMood.getCategory()) {
222 return false;
223 }
224
225 // Check confidence threshold
226 if (newMood.confidence < mConfidenceThreshold) {
227 return false;
228 }
229
230 // Check minimum duration (unless first mood or previous was invalid)
231 if (mPreviousMood.isValid() && mPreviousMood.duration < mMinDuration) {
232 // Allow early change if new mood is significantly more confident
233 float confidenceRatio = newMood.confidence / (mPreviousMood.confidence + 0.01f);
234 if (confidenceRatio < 1.3f) {
235 return false;
236 }
237 }
238
239 return true;
240}

References fl::audio::detector::Mood::confidence, fl::audio::detector::Mood::getCategory(), mConfidenceThreshold, mMinDuration, and mPreviousMood.

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: