Mercurial > hg > tony
comparison src/main.cpp @ 443:ea7ca3335a1a
Look up plugins in Tony-specific location in advance of generic Vamp locations (can be overridden in environment)
author | Chris Cannam |
---|---|
date | Tue, 31 Mar 2015 17:15:18 +0100 |
parents | a0eedd10dee3 |
children | 60779173dddf |
comparison
equal
deleted
inserted
replaced
442:12f2c987e2b5 | 443:ea7ca3335a1a |
---|---|
38 #include <QDir> | 38 #include <QDir> |
39 | 39 |
40 #include <iostream> | 40 #include <iostream> |
41 #include <signal.h> | 41 #include <signal.h> |
42 | 42 |
43 #include <vamp-hostsdk/PluginHostAdapter.h> | |
44 | |
43 static QMutex cleanupMutex; | 45 static QMutex cleanupMutex; |
44 static bool cleanedUp = false; | 46 static bool cleanedUp = false; |
45 | 47 |
46 static void | 48 static void |
47 signalHandler(int /* signal */) | 49 signalHandler(int /* signal */) |
112 } else { | 114 } else { |
113 return QApplication::event(event); | 115 return QApplication::event(event); |
114 } | 116 } |
115 } | 117 } |
116 }; | 118 }; |
119 | |
120 static void | |
121 setupTonyVampPath() | |
122 { | |
123 #ifdef Q_OS_WIN32 | |
124 QChar sep(';'); | |
125 QString programFiles = getenv("ProgramFiles"); | |
126 if (programFiles == "") programFiles = "C:\\Program Files"; | |
127 QString defaultTonyPath(programFiles + "\\Tony"); | |
128 #else | |
129 QChar sep(':'); | |
130 #ifdef Q_OS_MAC | |
131 QString defaultTonyPath; | |
132 #else | |
133 QString defaultTonyPath("/usr/local/lib/tony:/usr/lib/tony"); | |
134 #endif | |
135 #endif | |
136 | |
137 QString tonyVampPath = getenv("TONY_VAMP_PATH"); | |
138 if (tonyVampPath == "") { | |
139 tonyVampPath = defaultTonyPath; | |
140 } | |
141 if (tonyVampPath == "") { | |
142 // just use the default Vamp path or VAMP_PATH environment | |
143 // variable -- leave it up to the Vamp SDK | |
144 return; | |
145 } | |
146 | |
147 std::vector<std::string> vampPathList = | |
148 Vamp::PluginHostAdapter::getPluginPath(); | |
149 | |
150 QStringList qVampPathList; | |
151 for (auto p: vampPathList) qVampPathList.push_back(p.c_str()); | |
152 QString vampPath = qVampPathList.join(sep); | |
153 QString newPath = tonyVampPath + sep + vampPath; | |
154 | |
155 cerr << "Setting VAMP_PATH to " << newPath << " for Tony plugins" << endl; | |
156 | |
157 setenv("VAMP_PATH", newPath.toLocal8Bit().data(), 1); | |
158 } | |
117 | 159 |
118 int | 160 int |
119 main(int argc, char **argv) | 161 main(int argc, char **argv) |
120 { | 162 { |
121 svSystemSpecificInitialisation(); | 163 svSystemSpecificInitialisation(); |
124 if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) { | 166 if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) { |
125 // Fix for OS/X 10.9 font problem | 167 // Fix for OS/X 10.9 font problem |
126 QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); | 168 QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); |
127 } | 169 } |
128 #endif | 170 #endif |
171 | |
172 setupTonyVampPath(); | |
129 | 173 |
130 TonyApplication application(argc, argv); | 174 TonyApplication application(argc, argv); |
131 | 175 |
132 QStringList args = application.arguments(); | 176 QStringList args = application.arguments(); |
133 | 177 |