changeset 514:68ab0fe3bce4 3.0-integration

Merge from branch "tony-2.0-integration"
author Chris Cannam
date Thu, 04 Feb 2016 11:19:01 +0000
parents aecd5bdfc71f (current diff) 83c60632bac0 (diff)
children 51befd6165a3 36777aa80e15
files framework/MainWindowBase.cpp
diffstat 4 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp	Fri Jan 22 13:39:45 2016 +0000
+++ b/audio/AudioCallbackPlaySource.cpp	Thu Feb 04 11:19:01 2016 +0000
@@ -35,7 +35,7 @@
 #include <iostream>
 #include <cassert>
 
-#define DEBUG_AUDIO_PLAY_SOURCE 1
+//#define DEBUG_AUDIO_PLAY_SOURCE 1
 //#define DEBUG_AUDIO_PLAY_SOURCE_PLAYING 1
 
 static const int DEFAULT_RING_BUFFER_SIZE = 131071;
@@ -414,8 +414,6 @@
 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;
@@ -526,8 +524,6 @@
                        (m_lastCurrentFrame, m_sourceSampleRate).toText().c_str()));
     }
     m_lastCurrentFrame = 0;
-
-    if (m_target) m_target->suspend();
 }
 
 void
--- a/audio/AudioRecordTarget.cpp	Fri Jan 22 13:39:45 2016 +0000
+++ b/audio/AudioRecordTarget.cpp	Thu Feb 04 11:19:01 2016 +0000
@@ -98,10 +98,26 @@
 }
 
 QString
+AudioRecordTarget::getRecordContainerFolder()
+{
+    QDir parent(TempDirectory::getInstance()->getContainingPath());
+    QString subdirname("recorded");
+
+    if (!parent.mkpath(subdirname)) {
+        cerr << "ERROR: AudioRecordTarget::getRecordContainerFolder: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl;
+        return "";
+    } else {
+        return parent.filePath(subdirname);
+    }
+}
+
+QString
 AudioRecordTarget::getRecordFolder()
 {
-    QDir parent(TempDirectory::getInstance()->getContainingPath());
-    QString subdirname = "recorded"; //!!! tr?
+    QDir parent(getRecordContainerFolder());
+    QDateTime now = QDateTime::currentDateTime();
+    QString subdirname = QString("%1").arg(now.toString("yyyyMMdd"));
+
     if (!parent.mkpath(subdirname)) {
         cerr << "ERROR: AudioRecordTarget::getRecordFolder: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl;
         return "";
--- a/audio/AudioRecordTarget.h	Fri Jan 22 13:39:45 2016 +0000
+++ b/audio/AudioRecordTarget.h	Thu Feb 04 11:19:01 2016 +0000
@@ -51,6 +51,7 @@
 
     virtual void audioProcessingOverload() { }
 
+    QString getRecordContainerFolder();
     QString getRecordFolder();
     
     bool isRecording() const { return m_recording; }
--- a/framework/MainWindowBase.cpp	Fri Jan 22 13:39:45 2016 +0000
+++ b/framework/MainWindowBase.cpp	Thu Feb 04 11:19:01 2016 +0000
@@ -2205,6 +2205,7 @@
     } else {
         m_playTarget = breakfastquay::AudioFactory::
             createCallbackPlayTarget(m_playSource);
+        m_playTarget->suspend(); // start in suspended state
         m_playSource->setSystemPlaybackTarget(m_playTarget);
     }
 
@@ -2663,6 +2664,7 @@
         if (action) action->setChecked(false);
     } else {
         if (m_audioIO) m_audioIO->resume();
+        else if (m_playTarget) m_playTarget->resume();
         playbackFrameChanged(m_viewManager->getPlaybackFrame());
 	m_playSource->play(m_viewManager->getPlaybackFrame());
     }
@@ -2704,6 +2706,7 @@
     }
 
     m_audioIO->resume();
+
     WritableWaveFileModel *model = m_recordTarget->startRecording();
     if (!model) {
         cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
@@ -3041,6 +3044,7 @@
     m_playSource->stop();
 
     if (m_audioIO) m_audioIO->suspend();
+    else if (m_playTarget) m_playTarget->suspend();
     
     if (m_paneStack && m_paneStack->getCurrentPane()) {
         updateVisibleRangeDisplay(m_paneStack->getCurrentPane());