diff framework/MainWindowBase.cpp @ 501:c82cae9a9e74 3.0-integration

Merge from branch "tony-2.0-integration"
author Chris Cannam
date Wed, 14 Oct 2015 10:18:58 +0100
parents dcd2afbc1bb7 4f1d280903ad
children 0fe07a89fbbb
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Oct 14 10:17:32 2015 +0100
+++ b/framework/MainWindowBase.cpp	Wed Oct 14 10:18:58 2015 +0100
@@ -2661,6 +2661,7 @@
         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());
     }
@@ -2701,6 +2702,15 @@
         }
     }
 
+    QAction *action = qobject_cast<QAction *>(sender());
+    
+    if (m_audioRecordMode == RecordReplaceSession) {
+        if (!checkSaveModified()) {
+            if (action) action->setChecked(false);
+            return;
+        }
+    }
+
     m_audioIO->resume();
     WritableWaveFileModel *model = m_recordTarget->startRecording();
     if (!model) {
@@ -2800,6 +2810,8 @@
     updateMenuStates();
     m_recentFiles.addFile(model->getLocation());
     currentPaneChanged(m_paneStack->getCurrentPane());
+
+    emit audioFileLoaded();
 }
 
 void
@@ -3032,11 +3044,12 @@
 {
     if (m_recordTarget->isRecording()) {
         m_recordTarget->stopRecording();
-        emit audioFileLoaded();
     }
         
     m_playSource->stop();
 
+    if (m_audioIO) m_audioIO->suspend();
+    
     if (m_paneStack && m_paneStack->getCurrentPane()) {
         updateVisibleRangeDisplay(m_paneStack->getCurrentPane());
     } else {