MCPcopy Create free account
hub / github.com/FastLED/FastLED / shouldChangeMood

Method shouldChangeMood

src/fl/audio/detector/mood_analyzer.cpp.hpp:219–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219bool MoodAnalyzer::shouldChangeMood(const Mood& newMood) {
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}
241
242} // namespace detector
243} // namespace audio

Callers

nothing calls this directly

Calls 2

getCategoryMethod · 0.80
isValidMethod · 0.45

Tested by

no test coverage detected