diff framework/MainWindowBase.cpp @ 509:7cf6f5501212 tony-2.0-integration

Trim suspend/resume calls
author Chris Cannam
date Wed, 14 Oct 2015 16:02:09 +0100
parents 74fa499d5f3c
children 68ab0fe3bce4
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Oct 14 15:08:55 2015 +0100
+++ b/framework/MainWindowBase.cpp	Wed Oct 14 16:02:09 2015 +0100
@@ -2203,6 +2203,7 @@
     } else {
         m_playTarget = breakfastquay::AudioFactory::
             createCallbackPlayTarget(m_playSource);
+        m_playTarget->suspend(); // start in suspended state
         m_playSource->setSystemPlaybackTarget(m_playTarget);
     }
 
@@ -2661,6 +2662,7 @@
         if (action) action->setChecked(false);
     } else {
         if (m_audioIO) m_audioIO->resume();
+        else if (m_playTarget) m_playTarget->resume();
         playbackFrameChanged(m_viewManager->getPlaybackFrame());
 	m_playSource->play(m_viewManager->getPlaybackFrame());
     }
@@ -2702,6 +2704,7 @@
     }
 
     m_audioIO->resume();
+
     WritableWaveFileModel *model = m_recordTarget->startRecording();
     if (!model) {
         cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
@@ -3039,6 +3042,7 @@
     m_playSource->stop();
 
     if (m_audioIO) m_audioIO->suspend();
+    else if (m_playTarget) m_playTarget->suspend();
     
     if (m_paneStack && m_paneStack->getCurrentPane()) {
         updateVisibleRangeDisplay(m_paneStack->getCurrentPane());