2 Copyright (C) 2012-2014 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file libs/ardour/vst_info_file.cc
21 * @brief Code to manage info files containing cached information about a plugin.
22 * e.g. its name, creator etc.
29 #include <sys/types.h>
41 #include <glib/gstdio.h>
44 #include "pbd/error.h"
46 #ifndef VST_SCANNER_APP
47 #include "ardour/plugin_manager.h" // scanner_bin_path
48 #include "ardour/rc_configuration.h"
49 #include "ardour/system_exec.h"
52 #include "ardour/filesystem_paths.h"
53 #include "ardour/linux_vst_support.h"
54 #include "ardour/plugin_types.h"
55 #include "ardour/vst_info_file.h"
59 #define MAX_STRING_LEN 256
60 #define PLUGIN_SCAN_TIMEOUT (Config->get_vst_scan_timeout()) // in deciseconds
63 #ifndef VST_SCANNER_APP
68 #ifdef WINDOWS_VST_SUPPORT
71 vstfx_instantiate_and_get_info_fst (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID);
75 static bool vstfx_instantiate_and_get_info_lx (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID);
78 /* ID for shell plugins */
79 static int vstfx_current_loading_id = 0;
81 /* *** CACHE FILE PATHS *** */
84 get_vst_info_cache_dir () {
85 string dir = Glib::build_filename (ARDOUR::user_cache_directory (), "vst");
86 /* if the directory doesn't exist, try to create it */
87 if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
88 if (g_mkdir (dir.c_str (), 0700)) {
89 PBD::fatal << "Cannot create VST info folder '" << dir << "'" << endmsg;
96 vstfx_infofile_path (const char* dllpath)
101 sha1_write (&s, (const uint8_t *) dllpath, strlen (dllpath));
102 sha1_result_hash (&s, hash);
103 return Glib::build_filename (get_vst_info_cache_dir (), std::string (hash) + std::string (VST_EXT_INFOFILE));
107 /* *** VST Blacklist *** */
109 /** mark plugin as blacklisted */
110 static void vstfx_blacklist (const char *id)
112 string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST_BLACKLIST);
113 FILE * blacklist_fd = NULL;
114 if (! (blacklist_fd = g_fopen (fn.c_str (), "a"))) {
115 PBD::error << "Cannot append to VST blacklist for '"<< id <<"'\n";
118 assert (NULL == strchr (id, '\n'));
119 fprintf (blacklist_fd, "%s\n", id);
120 ::fclose (blacklist_fd);
123 /** mark plugin as not blacklisted */
124 static void vstfx_un_blacklist (const char *idcs)
127 string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST_BLACKLIST);
128 if (!Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
129 PBD::warning << "Expected VST Blacklist file does not exist.\n";
134 std::ifstream ifs (fn.c_str ());
135 bl.assign ((std::istreambuf_iterator<char> (ifs)), (std::istreambuf_iterator<char> ()));
136 ::g_unlink (fn.c_str ());
138 assert (id.find ("\n") == string::npos);
140 id += "\n"; // add separator
141 const size_t rpl = bl.find (id);
142 if (rpl != string::npos) {
143 bl.replace (rpl, id.size (), "");
149 FILE * blacklist_fd = NULL;
150 if (! (blacklist_fd = g_fopen (fn.c_str (), "w"))) {
151 PBD::error << "Cannot open VST blacklist.\n";
154 fprintf (blacklist_fd, "%s", bl.c_str ());
155 ::fclose (blacklist_fd);
158 /* return true if plugin is blacklisted */
159 static bool vst_is_blacklisted (const char *idcs)
161 // TODO ideally we'd also check if the VST has been updated since blacklisting
163 string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST_BLACKLIST);
164 if (!Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
168 std::ifstream ifs (fn.c_str ());
169 bl.assign ((std::istreambuf_iterator<char> (ifs)), (std::istreambuf_iterator<char> ()));
171 assert (id.find ("\n") == string::npos);
173 id += "\n"; // add separator
174 const size_t rpl = bl.find (id);
175 if (rpl != string::npos) {
183 /* *** MEMORY MANAGEMENT *** */
185 /** cleanup single allocated VSTInfo */
187 vstfx_free_info (VSTInfo *info)
189 for (int i = 0; i < info->numParams; i++) {
190 free (info->ParamNames[i]);
191 free (info->ParamLabels[i]);
195 free (info->creator);
196 free (info->Category);
197 free (info->ParamNames);
198 free (info->ParamLabels);
204 vstfx_clear_info_list (vector<VSTInfo *> *infos)
206 for (vector<VSTInfo *>::iterator i = infos->begin (); i != infos->end (); ++i) {
207 vstfx_free_info (*i);
213 /* *** CACHE FILE I/O *** */
215 /** Helper function to read a line from the cache file
216 * @return newly allocated string of NULL
219 read_string (FILE *fp)
221 char buf[MAX_STRING_LEN];
223 if (!fgets (buf, MAX_STRING_LEN, fp)) {
227 if (strlen (buf) < MAX_STRING_LEN) {
229 buf[strlen (buf)-1] = 0;
237 /** Read an integer value from a line in fp into n,
238 * @return true on failure, false on success.
241 read_int (FILE* fp, int* n)
243 char buf[MAX_STRING_LEN];
245 char* p = fgets (buf, MAX_STRING_LEN, fp);
250 return (sscanf (p, "%d", n) != 1);
253 /** parse a plugin-block from the cache info file */
255 vstfx_load_info_block (FILE* fp, VSTInfo *info)
257 if ((info->name = read_string (fp)) == 0) return false;
258 if ((info->creator = read_string (fp)) == 0) return false;
259 if (read_int (fp, &info->UniqueID)) return false;
260 if ((info->Category = read_string (fp)) == 0) return false;
261 if (read_int (fp, &info->numInputs)) return false;
262 if (read_int (fp, &info->numOutputs)) return false;
263 if (read_int (fp, &info->numParams)) return false;
264 if (read_int (fp, &info->wantMidi)) return false;
265 if (read_int (fp, &info->hasEditor)) return false;
266 if (read_int (fp, &info->canProcessReplacing)) return false;
268 /* backwards compatibility with old .fsi files */
269 if (info->wantMidi == -1) {
273 if ((info->numParams) == 0) {
274 info->ParamNames = NULL;
275 info->ParamLabels = NULL;
279 if ((info->ParamNames = (char **) malloc (sizeof (char*) * info->numParams)) == 0) {
283 for (int i = 0; i < info->numParams; ++i) {
284 if ((info->ParamNames[i] = read_string (fp)) == 0) return false;
287 if ((info->ParamLabels = (char **) malloc (sizeof (char*) * info->numParams)) == 0) {
291 for (int i = 0; i < info->numParams; ++i) {
292 if ((info->ParamLabels[i] = read_string (fp)) == 0) {
299 /** parse all blocks in a cache info file */
301 vstfx_load_info_file (FILE* fp, vector<VSTInfo*> *infos)
304 if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
307 if (vstfx_load_info_block (fp, info)) {
308 if (strncmp (info->Category, "Shell", 5)) {
309 infos->push_back (info);
312 vstfx_free_info (info);
313 if (!read_int (fp, &plugin_cnt)) {
314 for (int i = 0; i < plugin_cnt; i++) {
315 if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
316 vstfx_clear_info_list (infos);
319 if (vstfx_load_info_block (fp, info)) {
320 infos->push_back (info);
322 vstfx_free_info (info);
323 vstfx_clear_info_list (infos);
328 return false; /* Bad file */
333 vstfx_free_info (info);
334 vstfx_clear_info_list (infos);
339 vstfx_write_info_block (FILE* fp, VSTInfo *info)
344 fprintf (fp, "%s\n", info->name);
345 fprintf (fp, "%s\n", info->creator);
346 fprintf (fp, "%d\n", info->UniqueID);
347 fprintf (fp, "%s\n", info->Category);
348 fprintf (fp, "%d\n", info->numInputs);
349 fprintf (fp, "%d\n", info->numOutputs);
350 fprintf (fp, "%d\n", info->numParams);
351 fprintf (fp, "%d\n", info->wantMidi);
352 fprintf (fp, "%d\n", info->hasEditor);
353 fprintf (fp, "%d\n", info->canProcessReplacing);
355 for (int i = 0; i < info->numParams; i++) {
356 fprintf (fp, "%s\n", info->ParamNames[i]);
359 for (int i = 0; i < info->numParams; i++) {
360 fprintf (fp, "%s\n", info->ParamLabels[i]);
365 vstfx_write_info_file (FILE* fp, vector<VSTInfo *> *infos)
370 if (infos->size () > 1) {
371 vector<VSTInfo *>::iterator x = infos->begin ();
372 /* write out the shell info first along with count of the number of
373 * plugins contained in this shell
375 vstfx_write_info_block (fp, *x);
376 fprintf (fp, "%d\n", (int)infos->size () - 1 );
378 /* Now write out the info for each plugin */
379 for (; x != infos->end (); ++x) {
380 vstfx_write_info_block (fp, *x);
382 } else if (infos->size () == 1) {
383 vstfx_write_info_block (fp, infos->front ());
385 PBD::error << "Zero plugins in VST." << endmsg; // XXX here? rather make this impossible before if it ain't already.
390 /* *** CACHE MANAGEMENT *** */
392 /** remove info file from cache */
394 vstfx_remove_infofile (const char *dllpath)
396 ::g_unlink (vstfx_infofile_path (dllpath).c_str ());
399 /** cache file for given plugin
400 * @return FILE of the .fsi cache if found and up-to-date*/
402 vstfx_infofile_for_read (const char* dllpath)
404 const size_t slen = strlen (dllpath);
406 (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so"))
408 (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll"))
413 string const path = vstfx_infofile_path (dllpath);
415 if (Glib::file_test (path, Glib::FileTest (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR))) {
419 if (stat (dllpath, &dllstat) == 0) {
420 if (stat (path.c_str (), &fsistat) == 0) {
421 if (dllstat.st_mtime <= fsistat.st_mtime) {
422 /* plugin is older than info file */
423 return g_fopen (path.c_str (), "rb");
427 PBD::warning << "Ignored VST plugin which is newer than cache: " << dllpath << " (cache: " << path << " )" << endmsg;
428 PBD::into << "Re-Scan Plugins (Preferences > Plugis) to update the cache, also make sure your system-time is set correctly." << endmsg;
433 /** newly created cache file for given plugin
434 * @return FILE for the .fsi cache or NULL on error
437 vstfx_infofile_for_write (const char* dllpath)
439 const size_t slen = strlen (dllpath);
441 (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so"))
443 (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll"))
448 string const path = vstfx_infofile_path (dllpath);
450 PBD::info << "Creating VST cache file " << path << endmsg;
452 return g_fopen (path.c_str (), "wb");
455 /** check if cache-file exists, is up-to-date and parse cache file
456 * @param infos [return] loaded plugin info
457 * @return true if .fsi cache was read successfully, false otherwise
460 vstfx_get_info_from_file (const char* dllpath, vector<VSTInfo*> *infos)
464 if ((infofile = vstfx_infofile_for_read (dllpath)) != 0) {
465 rv = vstfx_load_info_file (infofile, infos);
468 PBD::warning << "Cannot get VST information form " << dllpath << ": info file load failed." << endmsg;
476 /* *** VST system-under-test methods *** */
479 bool vstfx_midi_input (VSTState* vstfx)
481 AEffect* plugin = vstfx->plugin;
483 int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
485 if (vst_version >= 2) {
486 /* should we send it VST events (i.e. MIDI) */
488 if ((plugin->flags & effFlagsIsSynth) || (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast<char*> ("receiveVstEvents"), 0.0f) > 0)) {
497 bool vstfx_midi_output (VSTState* vstfx)
499 AEffect* plugin = vstfx->plugin;
501 int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
503 if (vst_version >= 2) {
504 /* should we send it VST events (i.e. MIDI) */
506 if ( (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast<char*> ("sendVstEvents"), 0.0f) > 0)
507 || (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast<char*> ("sendVstMidiEvent"), 0.0f) > 0)
516 /** simple 'dummy' audiomaster callback to instantiate the plugin
517 * and query information
520 simple_master_callback (AEffect *, int32_t opcode, int32_t, intptr_t, void *ptr, float)
522 const char* vstfx_can_do_strings[] = {
528 "receiveVstMidiEvent",
533 const int vstfx_can_do_string_count = 9;
535 if (opcode == audioMasterVersion) {
538 else if (opcode == audioMasterCanDo) {
539 for (int i = 0; i < vstfx_can_do_string_count; i++) {
540 if (! strcmp (vstfx_can_do_strings[i], (const char*)ptr)) {
546 else if (opcode == audioMasterCurrentId) {
547 return vstfx_current_loading_id;
555 /** main plugin query and test function */
557 vstfx_parse_vst_state (VSTState* vstfx)
561 VSTInfo* info = (VSTInfo*) malloc (sizeof (VSTInfo));
566 /* We need to init the creator because some plugins
567 * fail to implement getVendorString, and so won't stuff the
568 * string with any name */
570 char creator[65] = "Unknown";
573 AEffect* plugin = vstfx->plugin;
576 plugin->dispatcher (plugin, effGetEffectName, 0, 0, name, 0);
578 if (strlen (name) == 0) {
579 plugin->dispatcher (plugin, effGetProductString, 0, 0, name, 0);
582 if (strlen (name) == 0) {
583 info->name = strdup (vstfx->handle->name);
585 info->name = strdup (name);
588 /*If the plugin doesn't bother to implement GetVendorString we will
589 * have pre-stuffed the string with 'Unknown' */
591 plugin->dispatcher (plugin, effGetVendorString, 0, 0, creator, 0);
593 /* Some plugins DO implement GetVendorString, but DON'T put a name in it
594 * so if its just a zero length string we replace it with 'Unknown' */
596 if (strlen (creator) == 0) {
597 info->creator = strdup ("Unknown");
599 info->creator = strdup (creator);
603 switch (plugin->dispatcher (plugin, effGetPlugCategory, 0, 0, 0, 0))
605 case kPlugCategEffect: info->Category = strdup ("Effect"); break;
606 case kPlugCategSynth: info->Category = strdup ("Synth"); break;
607 case kPlugCategAnalysis: info->Category = strdup ("Anaylsis"); break;
608 case kPlugCategMastering: info->Category = strdup ("Mastering"); break;
609 case kPlugCategSpacializer: info->Category = strdup ("Spacializer"); break;
610 case kPlugCategRoomFx: info->Category = strdup ("RoomFx"); break;
611 case kPlugSurroundFx: info->Category = strdup ("SurroundFx"); break;
612 case kPlugCategRestoration: info->Category = strdup ("Restoration"); break;
613 case kPlugCategOfflineProcess: info->Category = strdup ("Offline"); break;
614 case kPlugCategShell: info->Category = strdup ("Shell"); break;
615 case kPlugCategGenerator: info->Category = strdup ("Generator"); break;
616 default: info->Category = strdup ("Unknown"); break;
619 info->UniqueID = plugin->uniqueID;
621 info->numInputs = plugin->numInputs;
622 info->numOutputs = plugin->numOutputs;
623 info->numParams = plugin->numParams;
624 info->wantMidi = (vstfx_midi_input (vstfx) ? 1 : 0) | (vstfx_midi_output (vstfx) ? 2 : 0);
625 info->hasEditor = plugin->flags & effFlagsHasEditor ? true : false;
626 info->canProcessReplacing = plugin->flags & effFlagsCanReplacing ? true : false;
627 info->ParamNames = (char **) malloc (sizeof (char*)*info->numParams);
628 info->ParamLabels = (char **) malloc (sizeof (char*)*info->numParams);
630 for (int i = 0; i < info->numParams; ++i) {
634 /* Not all plugins give parameters labels as well as names */
636 strcpy (name, "No Name");
637 strcpy (label, "No Label");
639 plugin->dispatcher (plugin, effGetParamName, i, 0, name, 0);
640 info->ParamNames[i] = strdup (name);
642 //NOTE: 'effGetParamLabel' is no longer defined in vestige headers
643 //plugin->dispatcher (plugin, effGetParamLabel, i, 0, label, 0);
644 info->ParamLabels[i] = strdup (label);
649 /** wrapper around \ref vstfx_parse_vst_state,
650 * iterate over plugins in shell, translate VST-info into ardour VSTState
653 vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *> *infos, enum ARDOUR::PluginType type)
658 if (!(info = vstfx_parse_vst_state (vstfx))) {
662 infos->push_back (info);
663 #if 1 // shell-plugin support
664 /* If this plugin is a Shell and we are not already inside a shell plugin
665 * read the info for all of the plugins contained in this shell.
667 if (!strncmp (info->Category, "Shell", 5)
668 && vstfx->handle->plugincnt == 1) {
670 vector< pair<int, string> > ids;
671 AEffect *plugin = vstfx->plugin;
674 char name[65] = "Unknown";
675 id = plugin->dispatcher (plugin, effShellGetNextPlugin, 0, 0, name, 0);
676 ids.push_back (std::make_pair (id, name));
680 #ifdef WINDOWS_VST_SUPPORT
681 case ARDOUR::Windows_VST:
695 for (vector< pair<int, string> >::iterator x = ids.begin (); x != ids.end (); ++x) {
697 if (id == 0) continue;
698 /* recurse vstfx_get_info() */
702 #ifdef WINDOWS_VST_SUPPORT
703 case ARDOUR::Windows_VST:
704 ok = vstfx_instantiate_and_get_info_fst (dllpath, infos, id);
709 ok = vstfx_instantiate_and_get_info_lx (dllpath, infos, id);
717 // One shell (some?, all?) does not report the actual plugin name
718 // even after the shelled plugin has been instantiated.
719 // Replace the name of the shell with the real name.
720 info = infos->back ();
723 if ((*x).second.length () == 0) {
724 info->name = strdup ("Unknown");
727 info->name = strdup ((*x).second.c_str ());
733 #ifdef WINDOWS_VST_SUPPORT
734 case ARDOUR::Windows_VST:
753 /* *** TOP-LEVEL PLUGIN INSTANTIATION FUNCTIONS *** */
757 vstfx_instantiate_and_get_info_lx (
758 const char* dllpath, vector<VSTInfo*> *infos, int uniqueID)
762 if (!(h = vstfx_load (dllpath))) {
763 PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": load failed." << endmsg;
767 vstfx_current_loading_id = uniqueID;
769 if (!(vstfx = vstfx_instantiate (h, simple_master_callback, 0))) {
771 PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": instantiation failed." << endmsg;
775 vstfx_current_loading_id = 0;
777 vstfx_info_from_plugin (dllpath, vstfx, infos, ARDOUR::LXVST);
784 #ifdef WINDOWS_VST_SUPPORT
786 vstfx_instantiate_and_get_info_fst (
787 const char* dllpath, vector<VSTInfo*> *infos, int uniqueID)
791 if (!(h = fst_load (dllpath))) {
792 PBD::warning << "Cannot get Windows VST information from " << dllpath << ": load failed." << endmsg;
796 vstfx_current_loading_id = uniqueID;
798 if (!(vstfx = fst_instantiate (h, simple_master_callback, 0))) {
800 vstfx_current_loading_id = 0;
801 PBD::warning << "Cannot get Windows VST information from " << dllpath << ": instantiation failed." << endmsg;
804 vstfx_current_loading_id = 0;
806 vstfx_info_from_plugin (dllpath, vstfx, infos, ARDOUR::Windows_VST);
814 /* *** ERROR LOGGING *** */
815 #ifndef VST_SCANNER_APP
817 static FILE * _errorlog_fd = 0;
818 static char * _errorlog_dll = 0;
820 static void parse_scanner_output (std::string msg, size_t /*len*/)
822 if (!_errorlog_fd && !_errorlog_dll) {
823 PBD::error << "VST scanner: " << msg;
829 if (!(_errorlog_fd = g_fopen (vstfx_errorfile_path (_errorlog_dll).c_str (), "w"))) {
830 PBD::error << "Cannot create plugin error-log for plugin " << _errorlog_dll;
831 free (_errorlog_dll);
832 _errorlog_dll = NULL;
838 fprintf (_errorlog_fd, "%s\n", msg.c_str ());
839 } else if (_errorlog_dll) {
840 PBD::error << "VST '" << _errorlog_dll << "': " << msg;
842 PBD::error << "VST scanner: " << msg;
847 set_error_log (const char* dllpath) {
848 assert (!_errorlog_fd);
849 assert (!_errorlog_dll);
850 _errorlog_dll = strdup (dllpath);
856 fclose (_errorlog_fd);
859 free (_errorlog_dll);
866 /* *** the main function that uses all of the above *** */
868 static vector<VSTInfo *> *
869 vstfx_get_info (const char* dllpath, enum ARDOUR::PluginType type, enum VSTScanMode mode)
872 vector<VSTInfo*> *infos = new vector<VSTInfo*>;
874 if (vst_is_blacklisted (dllpath)) {
878 if (vstfx_get_info_from_file (dllpath, infos)) {
882 #ifndef VST_SCANNER_APP
883 std::string scanner_bin_path = ARDOUR::PluginManager::scanner_bin_path;
885 if (mode == VST_SCAN_CACHE_ONLY) {
886 /* never scan explicitly, use cache only */
889 else if (mode == VST_SCAN_USE_APP && scanner_bin_path != "") {
890 /* use external scanner app */
892 char **argp= (char**) calloc (3,sizeof (char*));
893 argp[0] = strdup (scanner_bin_path.c_str ());
894 argp[1] = strdup (dllpath);
897 set_error_log (dllpath);
898 ARDOUR::SystemExec scanner (scanner_bin_path, argp);
899 PBD::ScopedConnectionList cons;
900 scanner.ReadStdout.connect_same_thread (cons, boost::bind (&parse_scanner_output, _1 ,_2));
901 if (scanner.start (2 /* send stderr&stdout via signal */)) {
902 PBD::error << "Cannot launch VST scanner app '" << scanner_bin_path << "': "<< strerror (errno) << endmsg;
906 int timeout = PLUGIN_SCAN_TIMEOUT;
907 bool no_timeout = (timeout <= 0);
908 ARDOUR::PluginScanTimeout (timeout);
909 while (scanner.is_running () && (no_timeout || timeout > 0)) {
910 if (!no_timeout && !ARDOUR::PluginManager::instance ().no_timeout ()) {
911 if (timeout%5 == 0) {
912 ARDOUR::PluginScanTimeout (timeout);
917 Glib::usleep (100000);
919 if (ARDOUR::PluginManager::instance ().cancelled ()) {
920 // remove info file (might be incomplete)
921 vstfx_remove_infofile (dllpath);
922 // remove temporary blacklist file (scan incomplete)
923 vstfx_un_blacklist (dllpath);
924 scanner.terminate ();
929 scanner.terminate ();
932 /* re-read index (generated by external scanner) */
933 vstfx_clear_info_list (infos);
934 if (!vst_is_blacklisted (dllpath)) {
935 vstfx_get_info_from_file (dllpath, infos);
939 /* else .. instantiate and check in in ardour process itself */
941 (void) mode; // unused parameter
945 /* blacklist in case instantiation fails */
946 vstfx_blacklist (dllpath);
949 #ifdef WINDOWS_VST_SUPPORT
950 case ARDOUR::Windows_VST:
951 ok = vstfx_instantiate_and_get_info_fst (dllpath, infos, 0);
956 ok = vstfx_instantiate_and_get_info_lx (dllpath, infos, 0);
968 /* remove from blacklist */
969 vstfx_un_blacklist (dllpath);
971 /* crate cache/whitelist */
972 infofile = vstfx_infofile_for_write (dllpath);
974 PBD::warning << "Cannot cache VST information for " << dllpath << ": cannot create new FST info file." << endmsg;
977 vstfx_write_info_file (infofile, infos);
984 /* *** public API *** */
987 vstfx_free_info_list (vector<VSTInfo *> *infos)
989 for (vector<VSTInfo *>::iterator i = infos->begin (); i != infos->end (); ++i) {
990 vstfx_free_info (*i);
997 vstfx_get_info_lx (char* dllpath, enum VSTScanMode mode)
999 return vstfx_get_info (dllpath, ARDOUR::LXVST, mode);
1003 #ifdef WINDOWS_VST_SUPPORT
1005 vstfx_get_info_fst (char* dllpath, enum VSTScanMode mode)
1007 return vstfx_get_info (dllpath, ARDOUR::Windows_VST, mode);
1011 #ifndef VST_SCANNER_APP