diff main/main.cpp @ 214:37847fc0b381 spectrogram-cache-rejig

* Save and restore FFTW plans
author Chris Cannam
date Tue, 13 Nov 2007 13:51:07 +0000
parents 9e396b8d7dfc
children a3011df6ddad ddbde90773b0
line wrap: on
line diff
--- a/main/main.cpp	Fri Nov 09 17:46:58 2007 +0000
+++ b/main/main.cpp	Tue Nov 13 13:51:07 2007 +0000
@@ -36,6 +36,10 @@
 #include <iostream>
 #include <signal.h>
 
+#ifdef HAVE_FFTW3F
+#include <fftw3.h>
+#endif
+
 /*! \mainpage Sonic Visualiser
 
 \section interesting Summary of interesting classes
@@ -338,6 +342,14 @@
         }
     }
     
+#ifdef HAVE_FFTW3F
+    settings.beginGroup("FFTWisdom");
+    QString wisdom = settings.value("wisdom").toString();
+    if (wisdom != "") {
+        fftwf_import_wisdom_from_string(wisdom.toLocal8Bit().data());
+    }
+    settings.endGroup();
+#endif
 
 
 /*
@@ -353,5 +365,15 @@
     TempDirectory::getInstance()->cleanup();
     application.releaseMainWindow();
 
+#ifdef HAVE_FFTW3F
+    char *cwisdom = fftwf_export_wisdom_to_string();
+    if (cwisdom) {
+        settings.beginGroup("FFTWisdom");
+        settings.setValue("wisdom", cwisdom);
+        settings.endGroup();
+        fftwf_free(cwisdom);
+    }
+#endif
+
     return rv;
 }