History

Add option to auto mute microphone after lose face tracking

David Rowe committed 11 years ago

Commit ff7b2011 parent 95a56564 files · +26 −1Browse files

Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all

Unified · Split

interface/src/Application.cpp+22−1
@@ -339,7 +339,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 338 unmodified lines
339 _aboutToQuit(false),339 _aboutToQuit(false),
340 _notifiedPacketVersionMismatchThisDomain(false),340 _notifiedPacketVersionMismatchThisDomain(false),
341 _domainConnectionRefusals(QList<QString>()),341 _domainConnectionRefusals(QList<QString>()),
342 _maxOctreePPS(maxOctreePacketsPerSecond.get())342 _maxOctreePPS(maxOctreePacketsPerSecond.get()),
343 _lastFaceTrackerUpdate(0)
343{344{
344 setInstance(this);345 setInstance(this);
345#ifdef Q_OS_WIN346#ifdef Q_OS_WIN
@@ -2409,7 +2410,27 @@ void Application::update(float deltaTime) { · 2063 unmodified lines
2409 FaceTracker* tracker = getActiveFaceTracker();2410 FaceTracker* tracker = getActiveFaceTracker();
2410 if (tracker && !tracker->isMuted()) {2411 if (tracker && !tracker->isMuted()) {
2411 tracker->update(deltaTime);2412 tracker->update(deltaTime);
2413
2414 // Auto-mute microphone after losing face tracking?
2415 if (tracker->isTracking()) {
2416 _lastFaceTrackerUpdate = usecTimestampNow();
2417 } else {
2418 const quint64 MUTE_MICROPHONE_AFTER_USECS = 5000000; //5 secs
2419 Menu* menu = Menu::getInstance();
2420 if (menu->isOptionChecked(MenuOption::AutoMuteAudio) && !menu->isOptionChecked(MenuOption::MuteAudio)) {
2421 if (_lastFaceTrackerUpdate > 0
2422 && ((usecTimestampNow() - _lastFaceTrackerUpdate) > MUTE_MICROPHONE_AFTER_USECS)) {
2423 menu->triggerOption(MenuOption::MuteAudio);
2424 _lastFaceTrackerUpdate = 0;
2425 }
2426 } else {
2427 _lastFaceTrackerUpdate = 0;
2428 }
2429 }
2430 } else {
2431 _lastFaceTrackerUpdate = 0;
2412 }2432 }
2433
2413 SixenseManager::getInstance().update(deltaTime);2434 SixenseManager::getInstance().update(deltaTime);
2414 JoystickScriptingInterface::getInstance().update();2435 JoystickScriptingInterface::getInstance().update();
2415 }2436 }