changeset 186:06ad01f3e553

* Add system-specific LADSPA and DSSI plugin paths (for OS/X and Windows) * Add ability to open more than one audio file at once from the command line * Add plugin input source selection (with some caveats) * Show name of file being decoded in Ogg/mp3 decode progress dialog
author Chris Cannam
date Thu, 12 Oct 2006 14:56:28 +0000
parents d5052b5fea9c
children 89b05b679dc3
files data/fileio/MP3FileReader.cpp data/fileio/OggVorbisFileReader.cpp plugin/DSSIPluginFactory.cpp plugin/FeatureExtractionPluginFactory.cpp plugin/LADSPAPluginFactory.cpp system/System.h
diffstat 6 files changed, 56 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/MP3FileReader.cpp	Wed Oct 11 16:18:51 2006 +0000
+++ b/data/fileio/MP3FileReader.cpp	Thu Oct 12 14:56:28 2006 +0000
@@ -26,6 +26,7 @@
 #include <iostream>
 
 #include <QApplication>
+#include <QFileInfo>
 #include <QProgressDialog>
 
 MP3FileReader::MP3FileReader(QString path, bool showProgress, CacheMode mode) :
@@ -76,7 +77,7 @@
 
     if (showProgress) {
 	m_progress = new QProgressDialog
-	    (QObject::tr("Decoding MP3 file..."),
+	    (QObject::tr("Decoding %1...").arg(QFileInfo(path).fileName()),
 	     QObject::tr("Stop"), 0, 100);
 	m_progress->hide();
     }
--- a/data/fileio/OggVorbisFileReader.cpp	Wed Oct 11 16:18:51 2006 +0000
+++ b/data/fileio/OggVorbisFileReader.cpp	Thu Oct 12 14:56:28 2006 +0000
@@ -66,7 +66,7 @@
 
     if (showProgress) {
 	m_progress = new QProgressDialog
-	    (QObject::tr("Decoding Ogg file..."),
+	    (QObject::tr("Decoding %1...").arg(QFileInfo(path).fileName()),
 	     QObject::tr("Stop"), 0, 100);
 	m_progress->hide();
     }
--- a/plugin/DSSIPluginFactory.cpp	Wed Oct 11 16:18:51 2006 +0000
+++ b/plugin/DSSIPluginFactory.cpp	Thu Oct 12 14:56:28 2006 +0000
@@ -204,12 +204,27 @@
     if (cpath) path = cpath;
 
     if (path == "") {
-	path = "/usr/local/lib/dssi:/usr/lib/dssi";
+
+        path = DEFAULT_DSSI_PATH;
+
 	char *home = getenv("HOME");
 	if (home) {
-            path = std::string(home) + "/dssi:" +
-                   std::string(home) + "/.dssi:" + path;
+            std::string::size_type f;
+            while ((f = path.find("$HOME")) != std::string::npos &&
+                   f < path.length()) {
+                path.replace(f, 5, home);
+            }
         }
+
+#ifdef _WIN32
+        home = getenv("ProgramFiles");
+        if (!home) home = "C:\\Program Files";
+        std::string::size_type f;
+        while ((f = path.find("%ProgramFiles%")) != std::string::npos &&
+               f < path.length()) {
+            path.replace(f, 14, pfiles);
+        }
+#endif
     }
 
     std::string::size_type index = 0, newindex = 0;
--- a/plugin/FeatureExtractionPluginFactory.cpp	Wed Oct 11 16:18:51 2006 +0000
+++ b/plugin/FeatureExtractionPluginFactory.cpp	Thu Oct 12 14:56:28 2006 +0000
@@ -58,46 +58,9 @@
 {
     if (!m_pluginPath.empty()) return m_pluginPath;
 
-    std::vector<QString> path;
-    std::string envPath;
-
-    char *cpath = getenv("VAMP_PATH");
-    if (cpath) envPath = cpath;
-
-    if (envPath == "") {
-        envPath = DEFAULT_VAMP_PATH;
-        char *chome = getenv("HOME");
-        if (chome) {
-            std::string home(chome);
-            int f;
-            while ((f = envPath.find("$HOME")) >= 0 && f < envPath.length()) {
-                envPath.replace(f, 5, home);
-            }
-        }
-#ifdef Q_WS_WIN32
-        char *cpfiles = getenv("ProgramFiles");
-        if (!cpfiles) cpfiles = "C:\\Program Files";
-        std::string pfiles(cpfiles);
-        int f;
-        while ((f = envPath.find("%ProgramFiles%")) >= 0 && f < envPath.length()) {
-            envPath.replace(f, 14, pfiles);
-        }
-#endif
-    }
-
-    std::cerr << "VAMP path is: \"" << envPath << "\"" << std::endl;
-
-    std::string::size_type index = 0, newindex = 0;
-
-    while ((newindex = envPath.find(PATH_SEPARATOR, index)) < envPath.size()) {
-	path.push_back(envPath.substr(index, newindex - index).c_str());
-	index = newindex + 1;
-    }
-    
-    path.push_back(envPath.substr(index).c_str());
-
-    m_pluginPath = path;
-    return path;
+    std::vector<std::string> p = Vamp::PluginHostAdapter::getPluginPath();
+    for (size_t i = 0; i < p.size(); ++i) m_pluginPath.push_back(p[i].c_str());
+    return m_pluginPath;
 }
 
 std::vector<QString>
--- a/plugin/LADSPAPluginFactory.cpp	Wed Oct 11 16:18:51 2006 +0000
+++ b/plugin/LADSPAPluginFactory.cpp	Thu Oct 12 14:56:28 2006 +0000
@@ -528,9 +528,27 @@
     if (cpath) path = cpath;
 
     if (path == "") {
-	path = "/usr/local/lib/ladspa:/usr/lib/ladspa";
+
+        path = DEFAULT_LADSPA_PATH;
+
 	char *home = getenv("HOME");
-	if (home) path = std::string(home) + "/.ladspa:" + path;
+	if (home) {
+            std::string::size_type f;
+            while ((f = path.find("$HOME")) != std::string::npos &&
+                   f < path.length()) {
+                path.replace(f, 5, home);
+            }
+        }
+
+#ifdef _WIN32
+        home = getenv("ProgramFiles");
+        if (!home) home = "C:\\Program Files";
+        std::string::size_type f;
+        while ((f = path.find("%ProgramFiles%")) != std::string::npos &&
+               f < path.length()) {
+            path.replace(f, 14, pfiles);
+        }
+#endif
     }
 
     std::string::size_type index = 0, newindex = 0;
--- a/system/System.h	Wed Oct 11 16:18:51 2006 +0000
+++ b/system/System.h	Thu Oct 12 14:56:28 2006 +0000
@@ -32,8 +32,12 @@
 #define DLERROR()    ""
 
 #define PLUGIN_GLOB  "*.dll"
-#define PATH_SEPARATOR ';'
-#define DEFAULT_VAMP_PATH "%ProgramFiles%\\Vamp Plugins"
+
+// The default Vamp plugin path is obtained from a function in the Vamp SDK
+// (Vamp::PluginHostAdapter::getPluginPath).
+
+#define DEFAULT_LADSPA_PATH "%ProgramFiles%\\LADSPA Plugins"
+#define DEFAULT_DSSI_PATH   "%ProgramFiles%\\DSSI Plugins"
 
 #define getpid _getpid
 
@@ -56,17 +60,19 @@
 #define DLCLOSE(a)   dlclose((a))
 #define DLERROR()    dlerror()
 
-#define PATH_SEPARATOR ':'
-
 #ifdef __APPLE__
 
 #define PLUGIN_GLOB  "*.dylib"
-#define DEFAULT_VAMP_PATH "/Library/Audio/Plug-Ins/Vamp/:$HOME/Library/Audio/Plug-Ins/Vamp"
+
+#define DEFAULT_LADSPA_PATH "$HOME/Library/Audio/Plug-Ins/LADSPA:/Library/Audio/Plug-Ins/LADSPA"
+#define DEFAULT_DSSI_PATH   "$HOME/Library/Audio/Plug-Ins/DSSI:/Library/Audio/Plug-Ins/DSSI"
 
 #else 
 
 #define PLUGIN_GLOB  "*.so"
-#define DEFAULT_VAMP_PATH "/usr/local/lib/vamp:/usr/lib/vamp:$HOME/vamp:$HOME/.vamp"
+
+#define DEFAULT_LADSPA_PATH "$HOME/ladspa:$HOME/.ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa"
+#define DEFAULT_DSSI_PATH "$HOME/dssi:$HOME/.dssi:/usr/local/lib/dssi:/usr/lib/dssi"
 
 #endif /* __APPLE__ */