diff main/PreferencesDialog.cpp @ 1413:a89ca5ccb958 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 558347e7e1ab
children 13eb1d55f129
line wrap: on
line diff
--- a/main/PreferencesDialog.cpp	Mon Dec 12 09:13:44 2016 +0000
+++ b/main/PreferencesDialog.cpp	Mon Dec 12 15:45:33 2016 +0000
@@ -53,6 +53,7 @@
     m_audioImplementation(0),
     m_audioPlaybackDevice(0),
     m_audioRecordDevice(0),
+    m_audioDeviceChanged(false),
     m_changesOnRestart(false)
 {
     setWindowTitle(tr("Sonic Visualiser: Application Preferences"));
@@ -219,7 +220,7 @@
     settings.endGroup();
 
     rebuildDeviceCombos();
-    m_changesOnRestart = false; // the rebuild will have changed this
+    m_audioDeviceChanged = false; // the rebuild will have changed this
 
     QCheckBox *resampleOnLoad = new QCheckBox;
     m_resampleOnLoad = prefs->getResampleOnLoad();
@@ -695,7 +696,7 @@
         m_audioImplementation = s;
         rebuildDeviceCombos();
         m_applyButton->setEnabled(true);
-        m_changesOnRestart = true;
+        m_audioDeviceChanged = true;
     }
 }
 
@@ -705,7 +706,7 @@
     if (m_audioPlaybackDevice != s) {
         m_audioPlaybackDevice = s;
         m_applyButton->setEnabled(true);
-        m_changesOnRestart = true;
+        m_audioDeviceChanged = true;
     }
 }
 
@@ -715,7 +716,7 @@
     if (m_audioRecordDevice != s) {
         m_audioRecordDevice = s;
         m_applyButton->setEnabled(true);
-        m_changesOnRestart = true;
+        m_audioDeviceChanged = true;
     }
 }
 
@@ -918,6 +919,10 @@
                                  tr("<b>Restart required</b><p>One or more of the application preferences you have changed may not take full effect until Sonic Visualiser is restarted.</p><p>Please exit and restart the application now if you want these changes to take effect immediately.</p>"));
         m_changesOnRestart = false;
     }
+
+    if (m_audioDeviceChanged) {
+        emit audioDeviceChanged();
+    }
 }    
 
 void