diff framework/MainWindowBase.cpp @ 556:21e3aab6e3e7 3.0-integration

Reopen the audio device directly when preference is changed
author Chris Cannam
date Mon, 12 Dec 2016 15:45:33 +0000
parents 8c11ca1ebc39
children 7759c2dca846
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Fri Dec 09 19:04:33 2016 +0000
+++ b/framework/MainWindowBase.cpp	Mon Dec 12 15:45:33 2016 +0000
@@ -295,14 +295,8 @@
     // depends on whether we handle recording or not) before we delete
     // the ApplicationPlaybackSource and ApplicationRecordTarget that
     // they refer to.
-    
-    // First prevent this trying to call target.
-    if (m_playSource) m_playSource->setSystemPlaybackTarget(0);
-
-    // Then delete the breakfastquay::System object.
-    // Only one of these two exists!
-    delete m_audioIO;
-    delete m_playTarget;
+
+    deleteAudioIO();
 
     // Then delete the Application objects.
     delete m_resamplerWrapper;
@@ -2375,6 +2369,28 @@
     }
 }
 
+void
+MainWindowBase::deleteAudioIO()
+{
+    // First prevent this trying to call target.
+    if (m_playSource) m_playSource->setSystemPlaybackTarget(0);
+
+    // Then delete the breakfastquay::System object.
+    // Only one of these two exists!
+    delete m_audioIO;
+    delete m_playTarget;
+
+    m_audioIO = 0;
+    m_playTarget = 0;
+}
+
+void
+MainWindowBase::recreateAudioIO()
+{
+    deleteAudioIO();
+    createAudioIO();
+}
+
 WaveFileModel *
 MainWindowBase::getMainModel()
 {