changeset 500:dcd2afbc1bb7 3.0-integration

Merge, but dropping the last commit from the recording branch because I prefer the way it was done here
author Chris Cannam
date Wed, 14 Oct 2015 10:17:32 +0100
parents a4d90cf2bb79 (current diff) 40e7b4e1b569 (diff)
children c82cae9a9e74
files audio/AudioRecordTarget.cpp framework/MainWindowBase.cpp
diffstat 2 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioRecordTarget.cpp	Mon Oct 12 12:43:06 2015 +0100
+++ b/audio/AudioRecordTarget.cpp	Wed Oct 14 10:17:32 2015 +0100
@@ -41,13 +41,7 @@
 }
 
 void
-AudioRecordTarget::setSystemRecordSource(breakfastquay::SystemRecordSource *s)
-{
-    m_source = s;
-}
-
-void
-AudioRecordTarget::setSystemRecordBlockSize(int sz)
+AudioRecordTarget::setSystemRecordBlockSize(int)
 {
 }
 
@@ -58,7 +52,7 @@
 }
 
 void
-AudioRecordTarget::setSystemRecordLatency(int sz)
+AudioRecordTarget::setSystemRecordLatency(int)
 {
 }
 
@@ -92,7 +86,7 @@
 }
 
 void
-AudioRecordTarget::setInputLevels(float peakLeft, float peakRight)
+AudioRecordTarget::setInputLevels(float, float)
 {
 }
 
@@ -122,8 +116,6 @@
 WritableWaveFileModel *
 AudioRecordTarget::startRecording()
 {
-    if (m_source) m_source->resume();
-    
     {
     QMutexLocker locker(&m_mutex);
     
@@ -181,8 +173,6 @@
     m_recording = false;
     }
 
-    if (m_source) m_source->suspend();
-    
     emit recordStatusChanged(false);
 }
 
--- a/framework/MainWindowBase.cpp	Mon Oct 12 12:43:06 2015 +0100
+++ b/framework/MainWindowBase.cpp	Wed Oct 14 10:17:32 2015 +0100
@@ -2681,28 +2681,39 @@
     if (!m_audioIO) {
         createAudioIO();
     }
+
+    if (!m_audioIO) {
+        //!!! report
+        return;
+    }
     
     if (m_recordTarget->isRecording()) {
-        m_recordTarget->stopRecording();
-        emit audioFileLoaded();
+        stop();
         return;
     }
 
+    QAction *action = qobject_cast<QAction *>(sender());
+    
     if (m_audioRecordMode == RecordReplaceSession) {
-        if (!checkSaveModified()) return;
+        if (!checkSaveModified()) {
+            if (action) action->setChecked(false);
+            return;
+        }
     }
 
+    m_audioIO->resume();
     WritableWaveFileModel *model = m_recordTarget->startRecording();
     if (!model) {
         cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
         //!!! report
+        if (action) action->setChecked(false);
         return;
     }
 
     if (!model->isOK()) {
         m_recordTarget->stopRecording();
+        m_audioIO->suspend();
         delete model;
-        //!!! ???
         return;
     }
     
@@ -2718,6 +2729,9 @@
         if (templateName != "") {
             FileOpenStatus tplStatus = openSessionTemplate(templateName);
             if (tplStatus == FileOpenCancelled) {
+                m_recordTarget->stopRecording();
+                m_audioIO->suspend();
+                PlayParameterRepository::getInstance()->removePlayable(model);
                 return;
             }
             if (tplStatus != FileOpenFailed) {