# HG changeset patch # User Chris Cannam # Date 1481557533 0 # Node ID 21e3aab6e3e7395766025089630b89ec6479ff5a # Parent 2683a8ca36ea55b90917713571b9cef6cc049b5f Reopen the audio device directly when preference is changed diff -r 2683a8ca36ea -r 21e3aab6e3e7 framework/MainWindowBase.cpp --- 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() { diff -r 2683a8ca36ea -r 21e3aab6e3e7 framework/MainWindowBase.h --- a/framework/MainWindowBase.h Fri Dec 09 19:04:33 2016 +0000 +++ b/framework/MainWindowBase.h Mon Dec 12 15:45:33 2016 +0000 @@ -198,6 +198,7 @@ public slots: virtual void preferenceChanged(PropertyContainer::PropertyName); virtual void resizeConstrained(QSize); + virtual void recreateAudioIO(); protected slots: virtual void zoomIn(); @@ -464,6 +465,8 @@ virtual void setDefaultSessionTemplate(QString); virtual void createAudioIO(); + virtual void deleteAudioIO(); + virtual void openHelpUrl(QString url); virtual void openLocalFolder(QString path);