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 (diff) 40e7b4e1b569 (current diff)
children c82cae9a9e74
files audio/AudioRecordTarget.cpp framework/MainWindowBase.cpp
diffstat 5 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp	Mon Oct 12 15:06:02 2015 +0100
+++ b/audio/AudioCallbackPlaySource.cpp	Wed Oct 14 10:17:32 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	Mon Oct 12 15:06:02 2015 +0100
+++ b/audio/AudioCallbackPlaySource.h	Wed Oct 14 10:17:32 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	Mon Oct 12 15:06:02 2015 +0100
+++ b/audio/AudioRecordTarget.cpp	Wed Oct 14 10:17:32 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	Mon Oct 12 15:06:02 2015 +0100
+++ b/audio/AudioRecordTarget.h	Wed Oct 14 10:17:32 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);
@@ -66,6 +68,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	Mon Oct 12 15:06:02 2015 +0100
+++ b/framework/MainWindowBase.cpp	Wed Oct 14 10:17:32 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);
@@ -2660,7 +2661,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());
     }
@@ -2702,7 +2702,6 @@
     }
 
     m_audioIO->resume();
-
     WritableWaveFileModel *model = m_recordTarget->startRecording();
     if (!model) {
         cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
@@ -3038,8 +3037,6 @@
         
     m_playSource->stop();
 
-    if (m_audioIO) m_audioIO->suspend();
-    
     if (m_paneStack && m_paneStack->getCurrentPane()) {
         updateVisibleRangeDisplay(m_paneStack->getCurrentPane());
     } else {