diff framework/MainWindowBase.cpp @ 738:48001ed9143b audio-source-refactor

Introduce TimeStretchWrapper; some work towards making the AudioCallbackPlaySource not actually try to be an ApplicationPlaybackSource itself but only return one that is constructed from wrappers that it controls the lifespan of
author Chris Cannam
date Wed, 18 Mar 2020 12:51:41 +0000
parents 4b58b8f44be7
children 771ec060c1d2
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Feb 05 12:33:24 2020 +0000
+++ b/framework/MainWindowBase.cpp	Wed Mar 18 12:51:41 2020 +0000
@@ -82,7 +82,6 @@
 #include <bqaudioio/SystemPlaybackTarget.h>
 #include <bqaudioio/SystemAudioIO.h>
 #include <bqaudioio/AudioFactory.h>
-#include <bqaudioio/ResamplerWrapper.h>
 
 #include <QApplication>
 #include <QMessageBox>
@@ -151,7 +150,6 @@
     m_midiMode(midiMode),
     m_playSource(nullptr),
     m_recordTarget(nullptr),
-    m_resamplerWrapper(nullptr),
     m_playTarget(nullptr),
     m_audioIO(nullptr),
     m_oscQueue(nullptr),
@@ -2568,17 +2566,14 @@
     SVCERR << "createAudioIO: Preferred record device = \""
             << preference.recordDevice << "\"" << endl;
 
-    if (!m_resamplerWrapper) {
-        m_resamplerWrapper = new breakfastquay::ResamplerWrapper(m_playSource);
-        m_playSource->setResamplerWrapper(m_resamplerWrapper);
-    }
+    breakfastquay::ApplicationPlaybackSource *source =
+        m_playSource->getApplicationPlaybackSource();
 
     std::string errorString;
     
     if (m_audioMode == AUDIO_PLAYBACK_AND_RECORD) {
         m_audioIO = breakfastquay::AudioFactory::
-            createCallbackIO(m_recordTarget, m_resamplerWrapper,
-                             preference, errorString);
+            createCallbackIO(m_recordTarget, source, preference, errorString);
         if (m_audioIO) {
             SVCERR << "MainWindowBase::createAudioIO: Suspending on creation" << endl;
             m_audioIO->suspend(); // start in suspended state
@@ -2593,8 +2588,7 @@
 
     if (!m_audioIO) {
         m_playTarget = breakfastquay::AudioFactory::
-            createCallbackPlayTarget(m_resamplerWrapper,
-                                     preference, errorString);
+            createCallbackPlayTarget(source, preference, errorString);
         if (m_playTarget) {
             SVCERR << "MainWindowBase::createAudioIO: Suspending on creation" << endl;
             m_playTarget->suspend(); // start in suspended state
@@ -2648,7 +2642,6 @@
     // First prevent this trying to call target.
     if (m_playSource) {
         m_playSource->setSystemPlaybackTarget(nullptr);
-        m_playSource->setResamplerWrapper(nullptr);
     }
 
     // Then delete the breakfastquay::System object.
@@ -2656,14 +2649,8 @@
     delete m_audioIO;
     delete m_playTarget;
 
-    // And the breakfastquay resampler wrapper. We need to
-    // delete/recreate this if the channel count changes, which is one
-    // of the use cases for recreateAudioIO() calling this
-    delete m_resamplerWrapper;
-
     m_audioIO = nullptr;
     m_playTarget = nullptr;
-    m_resamplerWrapper = nullptr;
 }
 
 void