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"
45 #include "pbd/compose.h"
47 #ifndef VST_SCANNER_APP
48 #include "ardour/plugin_manager.h" // scanner_bin_path
49 #include "ardour/rc_configuration.h"
50 #include "ardour/system_exec.h"
53 #include "ardour/filesystem_paths.h"
54 #include "ardour/linux_vst_support.h"
55 #include "ardour/plugin_types.h"
56 #include "ardour/vst_info_file.h"
61 #define MAX_STRING_LEN 256
62 #define PLUGIN_SCAN_TIMEOUT (Config->get_vst_scan_timeout()) // in deciseconds
65 #ifndef VST_SCANNER_APP
70 #ifdef WINDOWS_VST_SUPPORT
73 vstfx_instantiate_and_get_info_fst (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID);
77 static bool vstfx_instantiate_and_get_info_lx (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID);
80 /* ID for shell plugins */
81 static int vstfx_current_loading_id = 0;
83 /* *** CACHE FILE PATHS *** */
86 get_vst_info_cache_dir () {
87 string dir = Glib::build_filename (ARDOUR::user_cache_directory (), "vst");
88 /* if the directory doesn't exist, try to create it */
89 if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
90 if (g_mkdir (dir.c_str (), 0700)) {
91 PBD::fatal << "Cannot create VST info folder '" << dir << "'" << endmsg;
98 vstfx_infofile_path (const char* dllpath)
103 sha1_write (&s, (const uint8_t *) dllpath, strlen (dllpath));
104 sha1_result_hash (&s, hash);
105 return Glib::build_filename (get_vst_info_cache_dir (), std::string (hash) + std::string (VST_EXT_INFOFILE));
109 /* *** VST Blacklist *** */
111 /** mark plugin as blacklisted */
112 static void vstfx_blacklist (const char *id)
114 string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST_BLACKLIST);
115 FILE * blacklist_fd = NULL;
116 if (! (blacklist_fd = g_fopen (fn.c_str (), "a"))) {
117 PBD::error << string_compose (_("Cannot append to VST blacklist for '%1'"), id) << endmsg;
120 assert (NULL == strchr (id, '\n'));
121 fprintf (blacklist_fd, "%s\n", id);
122 ::fclose (blacklist_fd);
125 /** mark plugin as not blacklisted */
126 static void vstfx_un_blacklist (const char *idcs)
129 string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST_BLACKLIST);
130 if (!Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
131 PBD::warning << _("Expected VST Blacklist file does not exist.") << endmsg;
136 std::ifstream ifs (fn.c_str ());
137 bl.assign ((std::istreambuf_iterator<char> (ifs)), (std::istreambuf_iterator<char> ()));
138 ::g_unlink (fn.c_str ());
140 assert (id.find ("\n") == string::npos);
142 id += "\n"; // add separator
143 const size_t rpl = bl.find (id);
144 if (rpl != string::npos) {
145 bl.replace (rpl, id.size (), "");
151 FILE * blacklist_fd = NULL;
152 if (! (blacklist_fd = g_fopen (fn.c_str (), "w"))) {
153 PBD::error << _("Cannot open VST blacklist.") << endmsg;;
156 fprintf (blacklist_fd, "%s", bl.c_str ());
157 ::fclose (blacklist_fd);
160 /* return true if plugin is blacklisted */
161 static bool vst_is_blacklisted (const char *idcs)
163 // TODO ideally we'd also check if the VST has been updated since blacklisting
165 string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST_BLACKLIST);
166 if (!Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
170 std::ifstream ifs (fn.c_str ());
171 bl.assign ((std::istreambuf_iterator<char> (ifs)), (std::istreambuf_iterator<char> ()));
173 assert (id.find ("\n") == string::npos);
175 id += "\n"; // add separator
176 const size_t rpl = bl.find (id);
177 if (rpl != string::npos) {
185 /* *** MEMORY MANAGEMENT *** */
187 /** cleanup single allocated VSTInfo */
189 vstfx_free_info (VSTInfo *info)
191 for (int i = 0; i < info->numParams; i++) {
192 free (info->ParamNames[i]);
193 free (info->ParamLabels[i]);
197 free (info->creator);
198 free (info->Category);
199 free (info->ParamNames);
200 free (info->ParamLabels);
206 vstfx_clear_info_list (vector<VSTInfo *> *infos)
208 for (vector<VSTInfo *>::iterator i = infos->begin (); i != infos->end (); ++i) {
209 vstfx_free_info (*i);
215 /* *** CACHE FILE I/O *** */
217 /** Helper function to read a line from the cache file
218 * @return newly allocated string of NULL
221 read_string (FILE *fp)
223 char buf[MAX_STRING_LEN];
225 if (!fgets (buf, MAX_STRING_LEN, fp)) {
229 if (strlen (buf) < MAX_STRING_LEN) {
231 buf[strlen (buf)-1] = 0;
239 /** Read an integer value from a line in fp into n,
240 * @return true on failure, false on success.
243 read_int (FILE* fp, int* n)
245 char buf[MAX_STRING_LEN];
247 char* p = fgets (buf, MAX_STRING_LEN, fp);
252 return (sscanf (p, "%d", n) != 1);
255 /** parse a plugin-block from the cache info file */
257 vstfx_load_info_block (FILE* fp, VSTInfo *info)
259 if ((info->name = read_string (fp)) == 0) return false;
260 if ((info->creator = read_string (fp)) == 0) return false;
261 if (read_int (fp, &info->UniqueID)) return false;
262 if ((info->Category = read_string (fp)) == 0) return false;
263 if (read_int (fp, &info->numInputs)) return false;
264 if (read_int (fp, &info->numOutputs)) return false;
265 if (read_int (fp, &info->numParams)) return false;
266 if (read_int (fp, &info->wantMidi)) return false;
267 if (read_int (fp, &info->hasEditor)) return false;
268 if (read_int (fp, &info->canProcessReplacing)) return false;
270 /* backwards compatibility with old .fsi files */
271 if (info->wantMidi == -1) {
275 if ((info->numParams) == 0) {
276 info->ParamNames = NULL;
277 info->ParamLabels = NULL;
281 if ((info->ParamNames = (char **) malloc (sizeof (char*) * info->numParams)) == 0) {
285 for (int i = 0; i < info->numParams; ++i) {
286 if ((info->ParamNames[i] = read_string (fp)) == 0) return false;
289 if ((info->ParamLabels = (char **) malloc (sizeof (char*) * info->numParams)) == 0) {
293 for (int i = 0; i < info->numParams; ++i) {
294 if ((info->ParamLabels[i] = read_string (fp)) == 0) {
301 /** parse all blocks in a cache info file */
303 vstfx_load_info_file (FILE* fp, vector<VSTInfo*> *infos)
306 if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
309 if (vstfx_load_info_block (fp, info)) {
310 if (strncmp (info->Category, "Shell", 5)) {
311 infos->push_back (info);
314 vstfx_free_info (info);
315 if (!read_int (fp, &plugin_cnt)) {
316 for (int i = 0; i < plugin_cnt; i++) {
317 if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
318 vstfx_clear_info_list (infos);
321 if (vstfx_load_info_block (fp, info)) {
322 infos->push_back (info);
324 vstfx_free_info (info);
325 vstfx_clear_info_list (infos);
330 return false; /* Bad file */
335 vstfx_free_info (info);
336 vstfx_clear_info_list (infos);
341 vstfx_write_info_block (FILE* fp, VSTInfo *info)
346 fprintf (fp, "%s\n", info->name);
347 fprintf (fp, "%s\n", info->creator);
348 fprintf (fp, "%d\n", info->UniqueID);
349 fprintf (fp, "%s\n", info->Category);
350 fprintf (fp, "%d\n", info->numInputs);
351 fprintf (fp, "%d\n", info->numOutputs);
352 fprintf (fp, "%d\n", info->numParams);
353 fprintf (fp, "%d\n", info->wantMidi);
354 fprintf (fp, "%d\n", info->hasEditor);
355 fprintf (fp, "%d\n", info->canProcessReplacing);
357 for (int i = 0; i < info->numParams; i++) {
358 fprintf (fp, "%s\n", info->ParamNames[i]);
361 for (int i = 0; i < info->numParams; i++) {
362 fprintf (fp, "%s\n", info->ParamLabels[i]);
367 vstfx_write_info_file (FILE* fp, vector<VSTInfo *> *infos)
372 if (infos->size () > 1) {
373 vector<VSTInfo *>::iterator x = infos->begin ();
374 /* write out the shell info first along with count of the number of
375 * plugins contained in this shell
377 vstfx_write_info_block (fp, *x);
378 fprintf (fp, "%d\n", (int)infos->size () - 1 );
380 /* Now write out the info for each plugin */
381 for (; x != infos->end (); ++x) {
382 vstfx_write_info_block (fp, *x);
384 } else if (infos->size () == 1) {
385 vstfx_write_info_block (fp, infos->front ());
387 PBD::warning << _("VST object file contains no plugins.") << endmsg;
392 /* *** CACHE MANAGEMENT *** */
394 /** remove info file from cache */
396 vstfx_remove_infofile (const char *dllpath)
398 ::g_unlink (vstfx_infofile_path (dllpath).c_str ());
401 /** cache file for given plugin
402 * @return FILE of the .fsi cache if found and up-to-date*/
404 vstfx_infofile_for_read (const char* dllpath)
406 const size_t slen = strlen (dllpath);
408 (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so"))
410 (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll"))
415 string const path = vstfx_infofile_path (dllpath);
417 if (Glib::file_test (path, Glib::FileTest (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR))) {
421 if (stat (dllpath, &dllstat) == 0) {
422 if (stat (path.c_str (), &fsistat) == 0) {
423 if (dllstat.st_mtime <= fsistat.st_mtime) {
424 /* plugin is older than info file */
425 return g_fopen (path.c_str (), "rb");
429 PBD::warning << string_compose (_("Ignored VST plugin which is newer than cache: '%1' (cache: '%2')"), dllpath, path) << endmsg;
430 PBD::info << _("Re-Scan Plugins (Preferences > Plugins) to update the cache, also make sure your system-time is set correctly.") << endmsg;
435 /** newly created cache file for given plugin
436 * @return FILE for the .fsi cache or NULL on error
439 vstfx_infofile_for_write (const char* dllpath)
441 const size_t slen = strlen (dllpath);
443 (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so"))
445 (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll"))
450 string const path = vstfx_infofile_path (dllpath);
451 return g_fopen (path.c_str (), "wb");
454 /** check if cache-file exists, is up-to-date and parse cache file
455 * @param infos [return] loaded plugin info
456 * @return true if .fsi cache was read successfully, false otherwise
459 vstfx_get_info_from_file (const char* dllpath, vector<VSTInfo*> *infos)
463 if ((infofile = vstfx_infofile_for_read (dllpath)) != 0) {
464 rv = vstfx_load_info_file (infofile, infos);
467 PBD::warning << string_compose (_("Cannot get VST information for '%1': failed to load cache file."), dllpath) << endmsg;
475 /* *** VST system-under-test methods *** */
478 bool vstfx_midi_input (VSTState* vstfx)
480 AEffect* plugin = vstfx->plugin;
482 int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
484 if (vst_version >= 2) {
485 /* should we send it VST events (i.e. MIDI) */
487 if ((plugin->flags & effFlagsIsSynth) || (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast<char*> ("receiveVstEvents"), 0.0f) > 0)) {
496 bool vstfx_midi_output (VSTState* vstfx)
498 AEffect* plugin = vstfx->plugin;
500 int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
502 if (vst_version >= 2) {
503 /* should we send it VST events (i.e. MIDI) */
505 if ( (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast<char*> ("sendVstEvents"), 0.0f) > 0)
506 || (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast<char*> ("sendVstMidiEvent"), 0.0f) > 0)
515 /** simple 'dummy' audiomaster callback to instantiate the plugin
516 * and query information
519 simple_master_callback (AEffect *, int32_t opcode, int32_t, intptr_t, void *ptr, float)
521 const char* vstfx_can_do_strings[] = {
527 "receiveVstMidiEvent",
532 const int vstfx_can_do_string_count = 9;
534 if (opcode == audioMasterVersion) {
537 else if (opcode == audioMasterCanDo) {
538 for (int i = 0; i < vstfx_can_do_string_count; i++) {
539 if (! strcmp (vstfx_can_do_strings[i], (const char*)ptr)) {
545 else if (opcode == audioMasterCurrentId) {
546 return vstfx_current_loading_id;
554 /** main plugin query and test function */
556 vstfx_parse_vst_state (VSTState* vstfx)
560 VSTInfo* info = (VSTInfo*) malloc (sizeof (VSTInfo));
565 /* We need to init the creator because some plugins
566 * fail to implement getVendorString, and so won't stuff the
567 * string with any name */
569 char creator[65] = "Unknown";
572 AEffect* plugin = vstfx->plugin;
575 plugin->dispatcher (plugin, effGetEffectName, 0, 0, name, 0);
577 if (strlen (name) == 0) {
578 plugin->dispatcher (plugin, effGetProductString, 0, 0, name, 0);
581 if (strlen (name) == 0) {
582 info->name = strdup (vstfx->handle->name);
584 info->name = strdup (name);
587 /*If the plugin doesn't bother to implement GetVendorString we will
588 * have pre-stuffed the string with 'Unknown' */
590 plugin->dispatcher (plugin, effGetVendorString, 0, 0, creator, 0);
592 /* Some plugins DO implement GetVendorString, but DON'T put a name in it
593 * so if its just a zero length string we replace it with 'Unknown' */
595 if (strlen (creator) == 0) {
596 info->creator = strdup ("Unknown");
598 info->creator = strdup (creator);
602 switch (plugin->dispatcher (plugin, effGetPlugCategory, 0, 0, 0, 0))
604 case kPlugCategEffect: info->Category = strdup ("Effect"); break;
605 case kPlugCategSynth: info->Category = strdup ("Synth"); break;
606 case kPlugCategAnalysis: info->Category = strdup ("Anaylsis"); break;
607 case kPlugCategMastering: info->Category = strdup ("Mastering"); break;
608 case kPlugCategSpacializer: info->Category = strdup ("Spacializer"); break;
609 case kPlugCategRoomFx: info->Category = strdup ("RoomFx"); break;
610 case kPlugSurroundFx: info->Category = strdup ("SurroundFx"); break;
611 case kPlugCategRestoration: info->Category = strdup ("Restoration"); break;
612 case kPlugCategOfflineProcess: info->Category = strdup ("Offline"); break;
613 case kPlugCategShell: info->Category = strdup ("Shell"); break;
614 case kPlugCategGenerator: info->Category = strdup ("Generator"); break;
615 default: info->Category = strdup ("Unknown"); break;
618 info->UniqueID = plugin->uniqueID;
620 info->numInputs = plugin->numInputs;
621 info->numOutputs = plugin->numOutputs;
622 info->numParams = plugin->numParams;
623 info->wantMidi = (vstfx_midi_input (vstfx) ? 1 : 0) | (vstfx_midi_output (vstfx) ? 2 : 0);
624 info->hasEditor = plugin->flags & effFlagsHasEditor ? true : false;
625 info->canProcessReplacing = plugin->flags & effFlagsCanReplacing ? true : false;
626 info->ParamNames = (char **) malloc (sizeof (char*)*info->numParams);
627 info->ParamLabels = (char **) malloc (sizeof (char*)*info->numParams);
629 for (int i = 0; i < info->numParams; ++i) {
633 /* Not all plugins give parameters labels as well as names */
635 strcpy (name, "No Name");
636 strcpy (label, "No Label");
638 plugin->dispatcher (plugin, effGetParamName, i, 0, name, 0);
639 info->ParamNames[i] = strdup (name);
641 //NOTE: 'effGetParamLabel' is no longer defined in vestige headers
642 //plugin->dispatcher (plugin, effGetParamLabel, i, 0, label, 0);
643 info->ParamLabels[i] = strdup (label);
648 /** wrapper around \ref vstfx_parse_vst_state,
649 * iterate over plugins in shell, translate VST-info into ardour VSTState
652 vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *> *infos, enum ARDOUR::PluginType type)
657 if (!(info = vstfx_parse_vst_state (vstfx))) {
661 infos->push_back (info);
662 #if 1 // shell-plugin support
663 /* If this plugin is a Shell and we are not already inside a shell plugin
664 * read the info for all of the plugins contained in this shell.
666 if (!strncmp (info->Category, "Shell", 5)
667 && vstfx->handle->plugincnt == 1) {
669 vector< pair<int, string> > ids;
670 AEffect *plugin = vstfx->plugin;
673 char name[65] = "Unknown";
674 id = plugin->dispatcher (plugin, effShellGetNextPlugin, 0, 0, name, 0);
675 ids.push_back (std::make_pair (id, name));
679 #ifdef WINDOWS_VST_SUPPORT
680 case ARDOUR::Windows_VST:
694 for (vector< pair<int, string> >::iterator x = ids.begin (); x != ids.end (); ++x) {
696 if (id == 0) continue;
697 /* recurse vstfx_get_info() */
701 #ifdef WINDOWS_VST_SUPPORT
702 case ARDOUR::Windows_VST:
703 ok = vstfx_instantiate_and_get_info_fst (dllpath, infos, id);
708 ok = vstfx_instantiate_and_get_info_lx (dllpath, infos, id);
716 // One shell (some?, all?) does not report the actual plugin name
717 // even after the shelled plugin has been instantiated.
718 // Replace the name of the shell with the real name.
719 info = infos->back ();
722 if ((*x).second.length () == 0) {
723 info->name = strdup ("Unknown");
726 info->name = strdup ((*x).second.c_str ());
732 #ifdef WINDOWS_VST_SUPPORT
733 case ARDOUR::Windows_VST:
752 /* *** TOP-LEVEL PLUGIN INSTANTIATION FUNCTIONS *** */
756 vstfx_instantiate_and_get_info_lx (
757 const char* dllpath, vector<VSTInfo*> *infos, int uniqueID)
761 if (!(h = vstfx_load (dllpath))) {
762 PBD::warning << string_compose (_("Cannot get LinuxVST information from '%1': load failed."), dllpath) << endmsg;
766 vstfx_current_loading_id = uniqueID;
768 if (!(vstfx = vstfx_instantiate (h, simple_master_callback, 0))) {
770 PBD::warning << string_compose (_("Cannot get LinuxVST information from '%1': instantiation failed."), dllpath) << endmsg;
774 vstfx_current_loading_id = 0;
776 vstfx_info_from_plugin (dllpath, vstfx, infos, ARDOUR::LXVST);
783 #ifdef WINDOWS_VST_SUPPORT
785 vstfx_instantiate_and_get_info_fst (
786 const char* dllpath, vector<VSTInfo*> *infos, int uniqueID)
790 if (!(h = fst_load (dllpath))) {
791 PBD::warning << string_compose (_("Cannot get Windows VST information from '%1': load failed."), dllpath) << endmsg;
795 vstfx_current_loading_id = uniqueID;
797 if (!(vstfx = fst_instantiate (h, simple_master_callback, 0))) {
799 vstfx_current_loading_id = 0;
800 PBD::warning << string_compose (_("Cannot get Windows VST information from '%1': instantiation failed."), dllpath) << endmsg;
803 vstfx_current_loading_id = 0;
805 vstfx_info_from_plugin (dllpath, vstfx, infos, ARDOUR::Windows_VST);
813 /* *** ERROR LOGGING *** */
814 #ifndef VST_SCANNER_APP
816 static FILE * _errorlog_fd = 0;
817 static char * _errorlog_dll = 0;
819 static void parse_scanner_output (std::string msg, size_t /*len*/)
821 if (!_errorlog_fd && !_errorlog_dll) {
822 PBD::error << "VST scanner: " << msg;
828 if (!(_errorlog_fd = g_fopen (vstfx_errorfile_path (_errorlog_dll).c_str (), "w"))) {
829 PBD::error << "Cannot create plugin error-log for plugin " << _errorlog_dll;
830 free (_errorlog_dll);
831 _errorlog_dll = NULL;
837 fprintf (_errorlog_fd, "%s\n", msg.c_str ());
838 } else if (_errorlog_dll) {
839 PBD::error << "VST '" << _errorlog_dll << "': " << msg;
841 PBD::error << "VST scanner: " << msg;
846 set_error_log (const char* dllpath) {
847 assert (!_errorlog_fd);
848 assert (!_errorlog_dll);
849 _errorlog_dll = strdup (dllpath);
855 fclose (_errorlog_fd);
858 free (_errorlog_dll);
865 /* *** the main function that uses all of the above *** */
867 static vector<VSTInfo *> *
868 vstfx_get_info (const char* dllpath, enum ARDOUR::PluginType type, enum VSTScanMode mode)
871 vector<VSTInfo*> *infos = new vector<VSTInfo*>;
873 if (vst_is_blacklisted (dllpath)) {
877 if (vstfx_get_info_from_file (dllpath, infos)) {
881 #ifndef VST_SCANNER_APP
882 std::string scanner_bin_path = ARDOUR::PluginManager::scanner_bin_path;
884 if (mode == VST_SCAN_CACHE_ONLY) {
885 /* never scan explicitly, use cache only */
888 else if (mode == VST_SCAN_USE_APP && scanner_bin_path != "") {
889 /* use external scanner app */
891 char **argp= (char**) calloc (3,sizeof (char*));
892 argp[0] = strdup (scanner_bin_path.c_str ());
893 argp[1] = strdup (dllpath);
896 set_error_log (dllpath);
897 ARDOUR::SystemExec scanner (scanner_bin_path, argp);
898 PBD::ScopedConnectionList cons;
899 scanner.ReadStdout.connect_same_thread (cons, boost::bind (&parse_scanner_output, _1 ,_2));
900 if (scanner.start (2 /* send stderr&stdout via signal */)) {
901 PBD::error << string_compose (_("Cannot launch VST scanner app '%1': %2"), scanner_bin_path, strerror (errno)) << endmsg;
905 int timeout = PLUGIN_SCAN_TIMEOUT;
906 bool no_timeout = (timeout <= 0);
907 ARDOUR::PluginScanTimeout (timeout);
908 while (scanner.is_running () && (no_timeout || timeout > 0)) {
909 if (!no_timeout && !ARDOUR::PluginManager::instance ().no_timeout ()) {
910 if (timeout%5 == 0) {
911 ARDOUR::PluginScanTimeout (timeout);
916 Glib::usleep (100000);
918 if (ARDOUR::PluginManager::instance ().cancelled ()) {
919 // remove info file (might be incomplete)
920 vstfx_remove_infofile (dllpath);
921 // remove temporary blacklist file (scan incomplete)
922 vstfx_un_blacklist (dllpath);
923 scanner.terminate ();
928 scanner.terminate ();
931 /* re-read index (generated by external scanner) */
932 vstfx_clear_info_list (infos);
933 if (!vst_is_blacklisted (dllpath)) {
934 vstfx_get_info_from_file (dllpath, infos);
938 /* else .. instantiate and check in in ardour process itself */
940 (void) mode; // unused parameter
944 /* blacklist in case instantiation fails */
945 vstfx_blacklist (dllpath);
948 #ifdef WINDOWS_VST_SUPPORT
949 case ARDOUR::Windows_VST:
950 ok = vstfx_instantiate_and_get_info_fst (dllpath, infos, 0);
955 ok = vstfx_instantiate_and_get_info_lx (dllpath, infos, 0);
967 /* remove from blacklist */
968 vstfx_un_blacklist (dllpath);
970 /* crate cache/whitelist */
971 infofile = vstfx_infofile_for_write (dllpath);
973 PBD::warning << string_compose (_("Cannot cache VST information for '%1': cannot create cache file."), dllpath) << endmsg;
976 vstfx_write_info_file (infofile, infos);
983 /* *** public API *** */
986 vstfx_free_info_list (vector<VSTInfo *> *infos)
988 for (vector<VSTInfo *>::iterator i = infos->begin (); i != infos->end (); ++i) {
989 vstfx_free_info (*i);
996 vstfx_get_info_lx (char* dllpath, enum VSTScanMode mode)
998 return vstfx_get_info (dllpath, ARDOUR::LXVST, mode);
1002 #ifdef WINDOWS_VST_SUPPORT
1004 vstfx_get_info_fst (char* dllpath, enum VSTScanMode mode)
1006 return vstfx_get_info (dllpath, ARDOUR::Windows_VST, mode);
1010 #ifndef VST_SCANNER_APP