diff framework/MainWindowBase.cpp @ 498:cd9dec2f47e8 recording

Fix suspending/resuming audio device; it wasn't suspending when playback reached the end, only when the user stopped explicitly
author Chris Cannam
date Tue, 22 Sep 2015 17:12:37 +0100
parents 66b92c188cbd
children a4d90cf2bb79
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Sep 16 15:16:54 2015 +0100
+++ b/framework/MainWindowBase.cpp	Tue Sep 22 17:12:37 2015 +0100
@@ -2202,6 +2202,7 @@
             createCallbackIO(m_recordTarget, m_playSource);
         m_audioIO->suspend(); // start in suspended state
         m_playSource->setSystemPlaybackTarget(m_audioIO);
+        m_recordTarget->setSystemRecordSource(m_audioIO);
     } else {
         m_playTarget = breakfastquay::AudioFactory::
             createCallbackPlayTarget(m_playSource);
@@ -2662,7 +2663,6 @@
         QAction *action = qobject_cast<QAction *>(sender());
         if (action) action->setChecked(false);
     } else {
-        if (m_audioIO) m_audioIO->resume();
         playbackFrameChanged(m_viewManager->getPlaybackFrame());
 	m_playSource->play(m_viewManager->getPlaybackFrame());
     }
@@ -2694,8 +2694,6 @@
         if (!checkSaveModified()) return;
     }
 
-    if (m_audioIO) m_audioIO->resume();
-
     WritableWaveFileModel *model = m_recordTarget->startRecording();
     if (!model) {
         cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
@@ -3027,8 +3025,6 @@
         
     m_playSource->stop();
 
-    if (m_audioIO) m_audioIO->suspend();
-    
     if (m_paneStack && m_paneStack->getCurrentPane()) {
         updateVisibleRangeDisplay(m_paneStack->getCurrentPane());
     } else {