diff base/Preferences.cpp @ 1225:ba16388b937d piper

Restore native-Vamp factory and make the choice between Piper and Native a preference
author Chris Cannam
date Fri, 21 Oct 2016 11:49:27 +0100
parents 26cf6d5251ec
children ff9697592bef
line wrap: on
line diff
--- a/base/Preferences.cpp	Thu Oct 20 18:31:02 2016 +0100
+++ b/base/Preferences.cpp	Fri Oct 21 11:49:27 2016 +0100
@@ -41,6 +41,7 @@
     m_propertyBoxLayout(VerticallyStacked),
     m_windowType(HanningWindow),
     m_resampleQuality(1),
+    m_runPluginsInProcess(true),
     m_omitRecentTemps(true),
     m_tempDirRoot(""),
     m_fixedSampleRate(0),
@@ -65,6 +66,7 @@
     m_windowType = WindowType
         (settings.value("window-type", int(HanningWindow)).toInt());
     m_resampleQuality = settings.value("resample-quality", 1).toInt();
+    m_runPluginsInProcess = settings.value("run-vamp-plugins-in-process", true).toBool();
     m_fixedSampleRate = settings.value("fixed-sample-rate", 0).toDouble();
     m_resampleOnLoad = settings.value("resample-on-load", false).toBool();
     m_normaliseAudio = settings.value("normalise-audio", false).toBool();
@@ -266,6 +268,10 @@
         return m_resampleQuality;
     }
 
+    if (name == "Run Vamp Plugins In Process") {
+        return m_runPluginsInProcess;
+    }
+    
     if (name == "Omit Temporaries from Recent Files") {
         if (deflt) *deflt = 1;
         return m_omitRecentTemps ? 1 : 0;
@@ -414,6 +420,8 @@
         setWindowType(WindowType(value));
     } else if (name == "Resample Quality") {
         setResampleQuality(value);
+    } else if (name == "Run Vamp Plugins In Process") {
+        setRunPluginsInProcess(value ? true : false);
     } else if (name == "Omit Temporaries from Recent Files") {
         setOmitTempsFromRecentFiles(value ? true : false);
     } else if (name == "Background Mode") {
@@ -519,6 +527,19 @@
 }
 
 void
+Preferences::setRunPluginsInProcess(bool run)
+{
+    if (m_runPluginsInProcess != run) {
+        m_runPluginsInProcess = run;
+        QSettings settings;
+        settings.beginGroup("Preferences");
+        settings.setValue("run-vamp-plugins-in-process", run);
+        settings.endGroup();
+        emit propertyChanged("Run Vamp Plugins In Process");
+    }
+}
+
+void
 Preferences::setOmitTempsFromRecentFiles(bool omit)
 {
     if (m_omitRecentTemps != omit) {