| 217 | } |
| 218 | |
| 219 | bool 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 |
nothing calls this directly
no test coverage detected