changeset 502:bfe468c89d30 tony-2.0-integration

Merge from branch "3.0-integration"
author Chris Cannam
date Wed, 14 Oct 2015 10:19:24 +0100
parents d1c70c680fa9 (current diff) c82cae9a9e74 (diff)
children 9a125d1c8a22
files
diffstat 5 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp	Tue Oct 13 14:26:40 2015 +0100
+++ b/audio/AudioCallbackPlaySource.cpp	Wed Oct 14 10:19:24 2015 +0100
@@ -407,6 +407,8 @@
 void
 AudioCallbackPlaySource::play(sv_frame_t startFrame)
 {
+    if (m_target) m_target->resume();
+    
     if (!m_sourceSampleRate) {
         cerr << "AudioCallbackPlaySource::play: No source sample rate available, not playing" << endl;
         return;
@@ -518,6 +520,8 @@
                        (m_lastCurrentFrame, m_sourceSampleRate).toText().c_str()));
     }
     m_lastCurrentFrame = 0;
+
+    if (m_target) m_target->suspend();
 }
 
 void
--- a/audio/AudioCallbackPlaySource.h	Tue Oct 13 14:26:40 2015 +0100
+++ b/audio/AudioCallbackPlaySource.h	Wed Oct 14 10:19:24 2015 +0100
@@ -116,8 +116,7 @@
     virtual sv_frame_t getPlayEndFrame() { return m_lastModelEndFrame; }
 
     /**
-     * Set the playback target.  This should be called by the target
-     * class.
+     * Set the playback target.
      */
     virtual void setSystemPlaybackTarget(breakfastquay::SystemPlaybackTarget *);
 
--- a/audio/AudioRecordTarget.cpp	Tue Oct 13 14:26:40 2015 +0100
+++ b/audio/AudioRecordTarget.cpp	Wed Oct 14 10:19:24 2015 +0100
@@ -19,11 +19,14 @@
 
 #include "data/model/WritableWaveFileModel.h"
 
+#include <bqaudioio/SystemRecordSource.h>
+
 #include <QDir>
 
 AudioRecordTarget::AudioRecordTarget(ViewManagerBase *manager,
 				     QString clientName) :
     m_viewManager(manager),
+    m_source(0),
     m_clientName(clientName.toUtf8().data()),
     m_recording(false),
     m_recordSampleRate(44100),
@@ -115,6 +118,7 @@
 {
     {
     QMutexLocker locker(&m_mutex);
+    
     if (m_recording) {
         cerr << "WARNING: AudioRecordTarget::startRecording: We are already recording" << endl;
         return 0;
--- a/audio/AudioRecordTarget.h	Tue Oct 13 14:26:40 2015 +0100
+++ b/audio/AudioRecordTarget.h	Wed Oct 14 10:19:24 2015 +0100
@@ -41,6 +41,8 @@
     virtual int getApplicationSampleRate() const { return 0; } // don't care
     virtual int getApplicationChannelCount() const { return 2; }
 
+    virtual void setSystemRecordSource(breakfastquay::SystemRecordSource *);
+
     virtual void setSystemRecordBlockSize(int);
     virtual void setSystemRecordSampleRate(int);
     virtual void setSystemRecordLatency(int);
@@ -67,6 +69,7 @@
     
 private:
     ViewManagerBase *m_viewManager;
+    breakfastquay::SystemRecordSource *m_source;
     std::string m_clientName;
     bool m_recording;
     sv_samplerate_t m_recordSampleRate;
--- a/framework/MainWindowBase.cpp	Tue Oct 13 14:26:40 2015 +0100
+++ b/framework/MainWindowBase.cpp	Wed Oct 14 10:19:24 2015 +0100
@@ -2200,6 +2200,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);
@@ -2701,8 +2702,16 @@
         }
     }
 
+    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) {
         cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;