comparison view/ViewManager.cpp @ 689:d8fc9659a206

Remove polling on play status, eliminating one source of idle wakeups (requires connection to playStatusChanged from callback play source)
author Chris Cannam
date Tue, 03 Dec 2013 12:34:38 +0000
parents 1a0dfcbffaf1
children ad12e428785b
comparison
equal deleted inserted replaced
683:692a8b9804fe 689:d8fc9659a206
451 } 451 }
452 452
453 void 453 void
454 ViewManager::playStatusChanged(bool /* playing */) 454 ViewManager::playStatusChanged(bool /* playing */)
455 { 455 {
456 #ifdef DEBUG_VIEW_MANAGER
457 cerr << "ViewManager::playStatusChanged" << endl;
458 #endif
456 checkPlayStatus(); 459 checkPlayStatus();
457 } 460 }
458 461
459 void 462 void
460 ViewManager::checkPlayStatus() 463 ViewManager::checkPlayStatus()
480 483
481 QTimer::singleShot(20, this, SLOT(checkPlayStatus())); 484 QTimer::singleShot(20, this, SLOT(checkPlayStatus()));
482 485
483 } else { 486 } else {
484 487
485 QTimer::singleShot(100, this, SLOT(checkPlayStatus()));
486
487 if (m_lastLeft != 0.0 || m_lastRight != 0.0) { 488 if (m_lastLeft != 0.0 || m_lastRight != 0.0) {
488 emit outputLevelsChanged(0.0, 0.0); 489 emit outputLevelsChanged(0.0, 0.0);
489 m_lastLeft = 0.0; 490 m_lastLeft = 0.0;
490 m_lastRight = 0.0; 491 m_lastRight = 0.0;
491 } 492 }
492 493
493 #ifdef DEBUG_VIEW_MANAGER 494 #ifdef DEBUG_VIEW_MANAGER
494 // cerr << "ViewManager::checkPlayStatus: Not playing" << endl; 495 cerr << "ViewManager::checkPlayStatus: Not playing" << endl;
495 #endif 496 #endif
496 } 497 }
497 } 498 }
498 499
499 bool 500 bool