From 809a67cf14ff73aa08a77cfb8fb88ec0d909049f Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Tue, 11 Dec 2012 00:18:14 +0000 Subject: Fix native vst path (VST_NATIVE_PATH, VST_PATH, then preset). Also ladspa, dssi paths. Added -help text. --- muse2/ChangeLog | 2 ++ muse2/muse/dssihost.cpp | 9 +++++++-- muse2/muse/main.cpp | 16 +++++++++++++++ muse2/muse/plugin.cpp | 14 +++++++++++-- muse2/muse/vst_native.cpp | 38 +++++++++++++++++++++++++++++++---- muse2/synti/simpledrums2/ssplugin.cpp | 9 +++++++-- 6 files changed, 78 insertions(+), 10 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 4bc26620..45013525 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,5 @@ +11.12.2012: + - Fix native vst path (VST_NATIVE_PATH, VST_PATH, then preset). Also ladspa, dssi paths. Added -help text. (Tim) 10.12.2012: - Changed versions to rc2 - Changed name of SimpleSynth to original name SimpleDrums, this diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp index f62d1434..8e49b368 100644 --- a/muse2/muse/dssihost.cpp +++ b/muse2/muse/dssihost.cpp @@ -32,6 +32,7 @@ // Support vst state saving/loading with vst chunks. //#define DSSI_VST_CHUNK_SUPPORT +#include #include #include #include @@ -187,10 +188,14 @@ static void scanDSSIDir(const QString& s) void initDSSI() { + std::string s; const char* dssiPath = getenv("DSSI_PATH"); if (dssiPath == 0) - dssiPath = "/usr/local/lib64/dssi:/usr/lib64/dssi:/usr/local/lib/dssi:/usr/lib/dssi"; - + { + const char* home = getenv("HOME"); + s = std::string(home) + std::string("/dssi:/usr/local/lib64/dssi:/usr/lib64/dssi:/usr/local/lib/dssi:/usr/lib/dssi"); + dssiPath = s.c_str(); + } const char* p = dssiPath; while (*p != '\0') { const char* pe = p; diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp index e233a28e..644fe65d 100644 --- a/muse2/muse/main.cpp +++ b/muse2/muse/main.cpp @@ -277,6 +277,22 @@ static void usage(const char* prog, const char* txt) " -graphicssystem Set backend used for on-screen widgets/QPixmaps: raster or opengl\n" " -qmljsdebugger = port Activate QML/JS debugger with port, formatted port:1234[,block]\n" ); + + fprintf(stderr, "\n"); + + fprintf(stderr, "Some useful environment variables:\n"); + fprintf(stderr, " LADSPA_PATH: Override where to look for ladspa plugins, or else\n" + " ~/ladspa:/usr/local/lib64/ladspa:/usr/lib64/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa\n\n"); +#ifdef DSSI_SUPPORT + fprintf(stderr, " DSSI_PATH: Override where to look for dssi plugins (dssi-vst plugins: VST_PATH), or else\n" + " ~/dssi:/usr/local/lib64/dssi:/usr/lib64/dssi:/usr/local/lib/dssi:/usr/lib/dssi\n\n" ); +#endif +#ifdef VST_NATIVE_SUPPORT + fprintf(stderr, " VST_NATIVE_PATH: Override where to look for native vst plugins, or else VST_PATH, or else\n" + " ~/vst:/usr/local/lib64/vst:/usr/local/lib/vst:/usr/lib64/vst:/usr/lib/vst\n\n"); +#endif + + fprintf(stderr, " LANG: Help browser language suffix (en etc.)\n"); fprintf(stderr, "\n"); } diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index 0ca7524c..203aac63 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -1076,13 +1077,18 @@ void initPlugins() { loadPluginDir(MusEGlobal::museGlobalLib + QString("/plugins")); + std::string s; const char* p = 0; // Take care of DSSI plugins first... #ifdef DSSI_SUPPORT const char* dssiPath = getenv("DSSI_PATH"); if (dssiPath == 0) - dssiPath = "/usr/local/lib64/dssi:/usr/lib64/dssi:/usr/local/lib/dssi:/usr/lib/dssi"; + { + const char* home = getenv("HOME"); + s = std::string(home) + std::string("/dssi:/usr/local/lib64/dssi:/usr/lib64/dssi:/usr/local/lib/dssi:/usr/lib/dssi"); + dssiPath = s.c_str(); + } p = dssiPath; while (*p != '\0') { const char* pe = p; @@ -1106,7 +1112,11 @@ void initPlugins() // Now do LADSPA plugins... const char* ladspaPath = getenv("LADSPA_PATH"); if (ladspaPath == 0) - ladspaPath = "/usr/local/lib64/ladspa:/usr/lib64/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa"; + { + const char* home = getenv("HOME"); + s = std::string(home) + std::string("/ladspa:/usr/local/lib64/ladspa:/usr/lib64/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa"); + ladspaPath = s.c_str(); + } p = ladspaPath; if(MusEGlobal::debugMsg) diff --git a/muse2/muse/vst_native.cpp b/muse2/muse/vst_native.cpp index 4cfc6113..bc058e9c 100644 --- a/muse2/muse/vst_native.cpp +++ b/muse2/muse/vst_native.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "globals.h" @@ -456,10 +457,39 @@ static void scanVstNativeDir(const QString& s) void initVST_Native() { - const char* vstPath = getenv("VST_NATIVE_PATH"); // FIXME TODO: What's the right path and env var? - if (vstPath == 0) - vstPath = "/usr/lib/vst:/usr/local/lib/vst"; - + std::string s; + const char* vstPath = getenv("VST_NATIVE_PATH"); + if (vstPath) + { + if (MusEGlobal::debugMsg) + fprintf(stderr, "scan native vst: VST_NATIVE_PATH is: %s\n", vstPath); + } + else + { + if (MusEGlobal::debugMsg) + fprintf(stderr, "scan native vst: VST_NATIVE_PATH not set\n"); + } + + if(!vstPath) + { + vstPath = getenv("VST_PATH"); + if (vstPath) + { + if (MusEGlobal::debugMsg) + fprintf(stderr, "scan native vst: VST_PATH is: %s\n", vstPath); + } + else + { + if (MusEGlobal::debugMsg) + fprintf(stderr, "scan native vst: VST_PATH not set\n"); + const char* home = getenv("HOME"); + s = std::string(home) + std::string("/vst:/usr/local/lib64/vst:/usr/local/lib/vst:/usr/lib64/vst:/usr/lib/vst"); + vstPath = s.c_str(); + if (MusEGlobal::debugMsg) + fprintf(stderr, "scan native vst: defaulting to path: %s\n", vstPath); + } + } + const char* p = vstPath; while (*p != '\0') { const char* pe = p; diff --git a/muse2/synti/simpledrums2/ssplugin.cpp b/muse2/synti/simpledrums2/ssplugin.cpp index 881594d7..f53ecec3 100644 --- a/muse2/synti/simpledrums2/ssplugin.cpp +++ b/muse2/synti/simpledrums2/ssplugin.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "ssplugin.h" #include "common.h" @@ -110,10 +111,14 @@ void SS_initPlugins() SS_TRACE_IN //loadPluginDir(museGlobalLib + QString("/plugins")); + std::string s; const char* ladspaPath = getenv("LADSPA_PATH"); if (ladspaPath == 0) - ladspaPath = "/usr/lib/ladspa:/usr/local/lib/ladspa:/usr/lib64/ladspa:/usr/local/lib64/ladspa"; - + { + const char* home = getenv("HOME"); + s = std::string(home) + std::string("/ladspa:/usr/local/lib64/ladspa:/usr/lib64/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa"); + ladspaPath = s.c_str(); + } const char* p = ladspaPath; while (*p != '\0') { const char* pe = p; -- cgit v1.2.3