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.
28 #include <sys/types.h>
40 #include <glib/gstdio.h>
43 #include "pbd/error.h"
45 #ifndef VST_SCANNER_APP
46 #include "pbd/system_exec.h"
47 #include "ardour/plugin_manager.h" // scanner_bin_path
50 #include "ardour/filesystem_paths.h"
51 #include "ardour/linux_vst_support.h"
52 #include "ardour/plugin_types.h"
53 #include "ardour/vst_info_file.h"
55 #define MAX_STRING_LEN 256
56 #define PLUGIN_SCAN_TIMEOUT (600) // in deciseconds
59 /* CACHE FILE PATHS */
60 #define EXT_BLACKLIST ".fsb"
61 #define EXT_ERRORFILE ".err"
62 #define EXT_INFOFILE ".fsi"
64 #define PFX_DOTFILE "."
68 #ifndef VST_SCANNER_APP
73 #ifdef WINDOWS_VST_SUPPORT
76 vstfx_instantiate_and_get_info_fst (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID);
80 static bool vstfx_instantiate_and_get_info_lx (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID);
83 /* ID for shell plugins */
84 static int vstfx_current_loading_id = 0;
88 /* *** CACHE FILE PATHS *** */
91 vstfx_cache_file (const char* dllpath, int personal, const char *ext)
95 dir = get_personal_vst_blacklist_dir();
97 dir = Glib::path_get_dirname (std::string(dllpath));
101 s << PFX_DOTFILE << Glib::path_get_basename (dllpath) << ext;
102 return Glib::build_filename (dir, s.str ());
106 vstfx_blacklist_path (const char* dllpath, int personal)
108 return vstfx_cache_file(dllpath, personal, EXT_BLACKLIST);
112 vstfx_infofile_path (const char* dllpath, int personal)
114 return vstfx_cache_file(dllpath, personal, EXT_INFOFILE);
118 vstfx_errorfile_path (const char* dllpath, int personal)
120 return vstfx_cache_file(dllpath, personal, EXT_ERRORFILE);
125 /* *** MEMORY MANAGEMENT *** */
127 /** cleanup single allocated VSTInfo */
129 vstfx_free_info (VSTInfo *info)
131 for (int i = 0; i < info->numParams; i++) {
132 free (info->ParamNames[i]);
133 free (info->ParamLabels[i]);
137 free (info->creator);
138 free (info->Category);
139 free (info->ParamNames);
140 free (info->ParamLabels);
146 vstfx_clear_info_list (vector<VSTInfo *> *infos)
148 for (vector<VSTInfo *>::iterator i = infos->begin(); i != infos->end(); ++i) {
156 /* *** CACHE FILE I/O *** */
158 /** Helper function to read a line from the cache file
159 * @return newly allocated string of NULL
162 read_string (FILE *fp)
164 char buf[MAX_STRING_LEN];
166 if (!fgets (buf, MAX_STRING_LEN, fp)) {
170 if (strlen(buf) < MAX_STRING_LEN) {
172 buf[strlen(buf)-1] = 0;
180 /** Read an integer value from a line in fp into n,
181 * @return true on failure, false on success.
184 read_int (FILE* fp, int* n)
186 char buf[MAX_STRING_LEN];
188 char* p = fgets (buf, MAX_STRING_LEN, fp);
193 return (sscanf (p, "%d", n) != 1);
196 /** parse a plugin-block from the cache info file */
198 vstfx_load_info_block(FILE* fp, VSTInfo *info)
200 if ((info->name = read_string(fp)) == 0) return false;
201 if ((info->creator = read_string(fp)) == 0) return false;
202 if (read_int (fp, &info->UniqueID)) return false;
203 if ((info->Category = read_string(fp)) == 0) return false;
204 if (read_int (fp, &info->numInputs)) return false;
205 if (read_int (fp, &info->numOutputs)) return false;
206 if (read_int (fp, &info->numParams)) return false;
207 if (read_int (fp, &info->wantMidi)) return false;
208 if (read_int (fp, &info->hasEditor)) return false;
209 if (read_int (fp, &info->canProcessReplacing)) return false;
211 /* backwards compatibility with old .fsi files */
212 if (info->wantMidi == -1) {
216 if ((info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams)) == 0) {
220 for (int i = 0; i < info->numParams; ++i) {
221 if ((info->ParamNames[i] = read_string(fp)) == 0) return false;
224 if ((info->ParamLabels = (char **) malloc(sizeof(char*)*info->numParams)) == 0) {
228 for (int i = 0; i < info->numParams; ++i) {
229 if ((info->ParamLabels[i] = read_string(fp)) == 0) {
236 /** parse all blocks in a cache info file */
238 vstfx_load_info_file (FILE* fp, vector<VSTInfo*> *infos)
241 if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
244 if (vstfx_load_info_block(fp, info)) {
245 if (strncmp (info->Category, "Shell", 5)) {
246 infos->push_back(info);
249 vstfx_free_info(info);
250 if (read_int (fp, &plugin_cnt)) {
251 for (int i = 0; i < plugin_cnt; i++) {
252 if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
253 vstfx_clear_info_list(infos);
256 if (vstfx_load_info_block(fp, info)) {
257 infos->push_back(info);
259 vstfx_free_info(info);
260 vstfx_clear_info_list(infos);
265 return false; /* Bad file */
270 vstfx_free_info(info);
271 vstfx_clear_info_list(infos);
276 vstfx_write_info_block (FILE* fp, VSTInfo *info)
281 fprintf (fp, "%s\n", info->name);
282 fprintf (fp, "%s\n", info->creator);
283 fprintf (fp, "%d\n", info->UniqueID);
284 fprintf (fp, "%s\n", info->Category);
285 fprintf (fp, "%d\n", info->numInputs);
286 fprintf (fp, "%d\n", info->numOutputs);
287 fprintf (fp, "%d\n", info->numParams);
288 fprintf (fp, "%d\n", info->wantMidi);
289 fprintf (fp, "%d\n", info->hasEditor);
290 fprintf (fp, "%d\n", info->canProcessReplacing);
292 for (int i = 0; i < info->numParams; i++) {
293 fprintf (fp, "%s\n", info->ParamNames[i]);
296 for (int i = 0; i < info->numParams; i++) {
297 fprintf (fp, "%s\n", info->ParamLabels[i]);
302 vstfx_write_info_file (FILE* fp, vector<VSTInfo *> *infos)
307 if (infos->size() > 1) {
308 vector<VSTInfo *>::iterator x = infos->begin();
309 /* write out the shell info first along with count of the number of
310 * plugins contained in this shell
312 vstfx_write_info_block(fp, *x);
313 fprintf( fp, "%d\n", (int)infos->size() - 1 );
315 /* Now write out the info for each plugin */
316 for (; x != infos->end(); ++x) {
317 vstfx_write_info_block(fp, *x);
319 } else if (infos->size() == 1) {
320 vstfx_write_info_block(fp, infos->front());
322 PBD::error << "Zero plugins in VST." << endmsg; // XXX here? rather make this impossible before if it ain't already.
327 /* *** CACHE AND BLACKLIST MANAGEMENT *** */
329 /* return true if plugin is blacklisted or has an invalid file extension */
331 vstfx_blacklist_stat (const char *dllpath, int personal)
333 if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) {
336 string const path = vstfx_blacklist_path (dllpath, personal);
338 if (Glib::file_test (path, Glib::FileTest (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR))) {
342 if (stat (dllpath, &dllstat) == 0 && stat (path.c_str(), &fsbstat) == 0) {
343 if (dllstat.st_mtime > fsbstat.st_mtime) {
344 /* plugin is newer than blacklist file */
348 /* stat failed or plugin is older than blacklist file */
351 /* blacklist file does not exist */
355 /* return true if plugin is blacklisted, checks both personal
356 * and global folder */
358 vstfx_check_blacklist (const char *dllpath)
360 if (vstfx_blacklist_stat(dllpath, 0)) return true;
361 if (vstfx_blacklist_stat(dllpath, 1)) return true;
365 /* create blacklist file, preferably in same folder as the
366 * plugin, fall back to personal folder in $HOME
369 vstfx_blacklist_file (const char *dllpath)
372 if ((f = fopen (vstfx_blacklist_path (dllpath, 0).c_str(), "w"))) {
375 return fopen (vstfx_blacklist_path (dllpath, 1).c_str(), "w");
378 /** mark plugin as blacklisted */
380 vstfx_blacklist (const char *dllpath)
382 FILE *f = vstfx_blacklist_file(dllpath);
390 /** mark plugin as not blacklisted */
392 vstfx_un_blacklist (const char *dllpath)
394 ::g_unlink(vstfx_blacklist_path (dllpath, 0).c_str());
395 ::g_unlink(vstfx_blacklist_path (dllpath, 1).c_str());
398 /** remove info file from cache */
400 vstfx_remove_infofile (const char *dllpath)
402 ::g_unlink(vstfx_infofile_path (dllpath, 0).c_str());
403 ::g_unlink(vstfx_infofile_path (dllpath, 1).c_str());
406 /** helper function, check if cache is newer than plugin
407 * @return path to cache file */
409 vstfx_infofile_stat (const char *dllpath, struct stat* statbuf, int personal)
411 if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) {
415 string const path = vstfx_infofile_path (dllpath, personal);
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(), statbuf) == 0) {
423 if (dllstat.st_mtime <= statbuf->st_mtime) {
424 /* plugin is older than info file */
425 return strdup (path.c_str ());
434 /** cache file for given plugin
435 * @return FILE of the .fsi cache if found and up-to-date*/
437 vstfx_infofile_for_read (const char* dllpath)
439 struct stat own_statbuf;
440 struct stat sys_statbuf;
443 char* own_info = vstfx_infofile_stat (dllpath, &own_statbuf, 1);
444 char* sys_info = vstfx_infofile_stat (dllpath, &sys_statbuf, 0);
448 if (own_statbuf.st_mtime <= sys_statbuf.st_mtime) {
449 /* system info file is newer, use it */
450 rv = g_fopen (sys_info, "rb");
453 rv = g_fopen (own_info, "rb");
455 } else if (sys_info) {
456 rv = g_fopen (sys_info, "rb");
464 /** helper function for \ref vstfx_infofile_for_write
465 * abstract global and personal cache folders
468 vstfx_infofile_create (const char* dllpath, int personal)
470 if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) {
474 string const path = vstfx_infofile_path (dllpath, personal);
475 return fopen (path.c_str(), "w");
478 /** newly created cache file for given plugin
479 * @return FILE for the .fsi cache, NULL if neither personal,
480 * nor global cache folder is writable */
482 vstfx_infofile_for_write (const char* dllpath)
486 if ((f = vstfx_infofile_create (dllpath, 0)) == 0) {
487 f = vstfx_infofile_create (dllpath, 1);
493 /** check if cache-file exists, is up-to-date and parse cache file
494 * @param infos [return] loaded plugin info
495 * @return true if .fsi cache was read successfully, false otherwise
498 vstfx_get_info_from_file(const char* dllpath, vector<VSTInfo*> *infos)
502 if ((infofile = vstfx_infofile_for_read (dllpath)) != 0) {
503 rv = vstfx_load_info_file(infofile, infos);
506 PBD::warning << "Cannot get VST information form " << dllpath << ": info file load failed." << endmsg;
514 /* *** VST system-under-test methods *** */
517 bool vstfx_midi_input (VSTState* vstfx)
519 AEffect* plugin = vstfx->plugin;
521 int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
523 if (vst_version >= 2) {
524 /* should we send it VST events (i.e. MIDI) */
526 if ((plugin->flags & effFlagsIsSynth) || (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "receiveVstEvents", 0.0f) > 0)) {
535 bool vstfx_midi_output (VSTState* vstfx)
537 AEffect* plugin = vstfx->plugin;
539 int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
541 if (vst_version >= 2) {
542 /* should we send it VST events (i.e. MIDI) */
544 if ( (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "sendVstEvents", 0.0f) > 0)
545 || (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "sendVstMidiEvent", 0.0f) > 0)
554 /** simple 'dummy' audiomaster callback to instantiate the plugin
555 * and query information
558 simple_master_callback (AEffect *, int32_t opcode, int32_t, intptr_t, void *ptr, float)
560 const char* vstfx_can_do_strings[] = {
564 const int vstfx_can_do_string_count = 2;
566 if (opcode == audioMasterVersion) {
569 else if (opcode == audioMasterCanDo) {
570 for (int i = 0; i < vstfx_can_do_string_count; i++) {
571 if (! strcmp(vstfx_can_do_strings[i], (const char*)ptr)) {
577 else if (opcode == audioMasterCurrentId) {
578 return vstfx_current_loading_id;
586 /** main plugin query and test function */
588 vstfx_parse_vst_state (VSTState* vstfx)
592 VSTInfo* info = (VSTInfo*) malloc (sizeof (VSTInfo));
597 /*We need to init the creator because some plugins
598 fail to implement getVendorString, and so won't stuff the
599 string with any name*/
601 char creator[65] = "Unknown\0";
603 AEffect* plugin = vstfx->plugin;
605 info->name = strdup (vstfx->handle->name);
607 /*If the plugin doesn't bother to implement GetVendorString we will
608 have pre-stuffed the string with 'Unkown' */
610 plugin->dispatcher (plugin, effGetVendorString, 0, 0, creator, 0);
612 /*Some plugins DO implement GetVendorString, but DON'T put a name in it
613 so if its just a zero length string we replace it with 'Unknown' */
615 if (strlen(creator) == 0) {
616 info->creator = strdup ("Unknown");
618 info->creator = strdup (creator);
622 switch (plugin->dispatcher (plugin, effGetPlugCategory, 0, 0, 0, 0))
624 case kPlugCategEffect: info->Category = strdup ("Effect"); break;
625 case kPlugCategSynth: info->Category = strdup ("Synth"); break;
626 case kPlugCategAnalysis: info->Category = strdup ("Anaylsis"); break;
627 case kPlugCategMastering: info->Category = strdup ("Mastering"); break;
628 case kPlugCategSpacializer: info->Category = strdup ("Spacializer"); break;
629 case kPlugCategRoomFx: info->Category = strdup ("RoomFx"); break;
630 case kPlugSurroundFx: info->Category = strdup ("SurroundFx"); break;
631 case kPlugCategRestoration: info->Category = strdup ("Restoration"); break;
632 case kPlugCategOfflineProcess: info->Category = strdup ("Offline"); break;
633 case kPlugCategShell: info->Category = strdup ("Shell"); break;
634 case kPlugCategGenerator: info->Category = strdup ("Generator"); break;
635 default: info->Category = strdup ("Unknown"); break;
638 info->UniqueID = plugin->uniqueID;
640 info->numInputs = plugin->numInputs;
641 info->numOutputs = plugin->numOutputs;
642 info->numParams = plugin->numParams;
643 info->wantMidi = (vstfx_midi_input(vstfx) ? 1 : 0) | (vstfx_midi_output(vstfx) ? 2 : 0);
644 info->hasEditor = plugin->flags & effFlagsHasEditor ? true : false;
645 info->canProcessReplacing = plugin->flags & effFlagsCanReplacing ? true : false;
646 info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams);
647 info->ParamLabels = (char **) malloc(sizeof(char*)*info->numParams);
649 for (int i = 0; i < info->numParams; ++i) {
653 /* Not all plugins give parameters labels as well as names */
655 strcpy (name, "No Name");
656 strcpy (label, "No Label");
658 plugin->dispatcher (plugin, effGetParamName, i, 0, name, 0);
659 info->ParamNames[i] = strdup(name);
661 //NOTE: 'effGetParamLabel' is no longer defined in vestige headers
662 //plugin->dispatcher (plugin, effGetParamLabel, i, 0, label, 0);
663 info->ParamLabels[i] = strdup(label);
668 /** wrapper around \ref vstfx_parse_vst_state,
669 * iterate over plugins in shell, translate VST-info into ardour VSTState
672 vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *> *infos, enum ARDOUR::PluginType type)
677 if (!(info = vstfx_parse_vst_state(vstfx))) {
681 infos->push_back(info);
682 #if 1 // shell-plugin support
683 /* If this plugin is a Shell and we are not already inside a shell plugin
684 * read the info for all of the plugins contained in this shell.
686 if (!strncmp (info->Category, "Shell", 5)
687 && vstfx->handle->plugincnt == 1) {
689 vector< pair<int, string> > ids;
690 AEffect *plugin = vstfx->plugin;
691 string path = vstfx->handle->path;
694 char name[65] = "Unknown\0";
695 id = plugin->dispatcher (plugin, effShellGetNextPlugin, 0, 0, name, 0);
696 ids.push_back(std::make_pair(id, name));
700 #ifdef WINDOWS_VST_SUPPORT
701 case 1: fst_close(vstfx); break;
704 case 2: vstfx_close (vstfx); break;
706 default: assert(0); break;
709 for (vector< pair<int, string> >::iterator x = ids.begin(); x != ids.end(); ++x) {
711 if (id == 0) continue;
712 /* recurse vstfx_get_info() */
716 #ifdef WINDOWS_VST_SUPPORT
717 case ARDOUR::Windows_VST: ok = vstfx_instantiate_and_get_info_fst(dllpath, infos, id); break;
720 case ARDOUR::LXVST: ok = vstfx_instantiate_and_get_info_lx(dllpath, infos, id); break;
725 // One shell (some?, all?) does not report the actual plugin name
726 // even after the shelled plugin has been instantiated.
727 // Replace the name of the shell with the real name.
728 info = infos->back();
731 if ((*x).second.length() == 0) {
732 info->name = strdup("Unknown");
735 info->name = strdup ((*x).second.c_str());
745 /* *** TOP-LEVEL PLUGIN INSTANTIATION FUNCTIONS *** */
749 vstfx_instantiate_and_get_info_lx (
750 const char* dllpath, vector<VSTInfo*> *infos, int uniqueID)
754 if (!(h = vstfx_load(dllpath))) {
755 PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": load failed." << endmsg;
759 vstfx_current_loading_id = uniqueID;
761 if (!(vstfx = vstfx_instantiate(h, simple_master_callback, 0))) {
763 PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": instantiation failed." << endmsg;
767 vstfx_current_loading_id = 0;
769 vstfx_info_from_plugin(dllpath, vstfx, infos, ARDOUR::LXVST);
777 #ifdef WINDOWS_VST_SUPPORT
779 vstfx_instantiate_and_get_info_fst (
780 const char* dllpath, vector<VSTInfo*> *infos, int uniqueID)
784 if(!(h = fst_load(dllpath))) {
785 PBD::warning << "Cannot get Windows VST information from " << dllpath << ": load failed." << endmsg;
789 vstfx_current_loading_id = uniqueID;
791 if(!(vstfx = fst_instantiate(h, simple_master_callback, 0))) {
793 vstfx_current_loading_id = 0;
794 PBD::warning << "Cannot get Windows VST information from " << dllpath << ": instantiation failed." << endmsg;
797 vstfx_current_loading_id = 0;
799 vstfx_info_from_plugin(dllpath, vstfx, infos, ARDOUR::Windows_VST);
802 //fst_unload(&h); // XXX -> fst_close()
809 /* *** ERROR LOGGING *** */
810 #ifndef VST_SCANNER_APP
812 static FILE * _errorlog_fd = 0;
813 static char * _errorlog_dll = 0;
815 static void parse_scanner_output (std::string msg, size_t /*len*/)
817 if (!_errorlog_fd && !_errorlog_dll) {
818 PBD::error << "VST scanner: " << msg;
823 if (!(_errorlog_fd = fopen(vstfx_errorfile_path(_errorlog_dll, 0).c_str(), "w"))) {
824 if (!(_errorlog_fd = fopen(vstfx_errorfile_path(_errorlog_dll, 1).c_str(), "w"))) {
825 PBD::error << "Cannot create plugin error-log for plugin " << _errorlog_dll;
827 _errorlog_dll = NULL;
833 fprintf (_errorlog_fd, "%s\n", msg.c_str());
835 PBD::error << "VST scanner: " << msg;
840 set_error_log (const char* dllpath) {
841 assert(!_errorlog_fd);
842 assert(!_errorlog_dll);
843 _errorlog_dll = strdup(dllpath);
849 fclose(_errorlog_fd);
859 /* *** THE MAIN FUNCTION THAT USES ALL OF THE ABOVE :) *** */
861 static vector<VSTInfo *> *
862 vstfx_get_info (const char* dllpath, enum ARDOUR::PluginType type, enum VSTScanMode mode)
865 vector<VSTInfo*> *infos = new vector<VSTInfo*>;
867 if (vstfx_check_blacklist(dllpath)) {
871 if (vstfx_get_info_from_file(dllpath, infos)) {
875 #ifndef VST_SCANNER_APP
876 std::string scanner_bin_path = ARDOUR::PluginManager::scanner_bin_path;
878 if (mode == VST_SCAN_CACHE_ONLY) {
879 /* never scan explicitly, use cache only */
882 else if (mode == VST_SCAN_USE_APP && scanner_bin_path != "") {
883 /* use external scanner app */
885 char **argp= (char**) calloc(3,sizeof(char*));
886 argp[0] = strdup(scanner_bin_path.c_str());
887 argp[1] = strdup(dllpath);
890 set_error_log(dllpath);
891 PBD::SystemExec scanner (scanner_bin_path, argp);
892 PBD::ScopedConnectionList cons;
893 scanner.ReadStdout.connect_same_thread (cons, boost::bind (&parse_scanner_output, _1 ,_2));
894 if (scanner.start (2 /* send stderr&stdout via signal */)) {
895 PBD::error << "Cannot launch VST scanner app '" << scanner_bin_path << "': "<< strerror(errno) << endmsg;
899 int timeout = PLUGIN_SCAN_TIMEOUT;
900 while (scanner.is_running() && --timeout) {
902 Glib::usleep (100000);
904 if (ARDOUR::PluginManager::instance().cancelled()) {
905 // remove info file (might be incomplete)
906 vstfx_remove_infofile(dllpath);
907 // remove temporary blacklist file (scan incomplete)
908 vstfx_un_blacklist(dllpath);
917 /* re-read index (generated by external scanner) */
918 vstfx_clear_info_list(infos);
919 if (!vstfx_check_blacklist(dllpath)) {
920 vstfx_get_info_from_file(dllpath, infos);
924 /* else .. instantiate and check in in ardour process itself */
926 (void) mode; // unused parameter
930 /* blacklist in case instantiation fails */
931 vstfx_blacklist(dllpath);
934 #ifdef WINDOWS_VST_SUPPORT
935 case ARDOUR::Windows_VST: ok = vstfx_instantiate_and_get_info_fst(dllpath, infos, 0); break;
938 case ARDOUR::LXVST: ok = vstfx_instantiate_and_get_info_lx(dllpath, infos, 0); break;
947 /* remove from blacklist */
948 vstfx_un_blacklist(dllpath);
950 /* crate cache/whitelist */
951 infofile = vstfx_infofile_for_write (dllpath);
953 PBD::warning << "Cannot cache VST information for " << dllpath << ": cannot create new FST info file." << endmsg;
956 vstfx_write_info_file (infofile, infos);
964 /* *** public API *** */
967 vstfx_free_info_list (vector<VSTInfo *> *infos)
969 for (vector<VSTInfo *>::iterator i = infos->begin(); i != infos->end(); ++i) {
976 get_personal_vst_blacklist_dir() {
977 string dir = Glib::build_filename (ARDOUR::user_cache_directory(), "fst_blacklist");
978 /* if the directory doesn't exist, try to create it */
979 if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
980 if (g_mkdir (dir.c_str (), 0700)) {
981 PBD::error << "Cannot create VST blacklist folder '" << dir << "'" << endmsg;
989 get_personal_vst_info_cache_dir() {
990 string dir = Glib::build_filename (ARDOUR::user_cache_directory(), "fst_info");
991 /* if the directory doesn't exist, try to create it */
992 if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
993 if (g_mkdir (dir.c_str (), 0700)) {
994 PBD::error << "Cannot create VST info folder '" << dir << "'" << endmsg;
1001 #ifdef LXVST_SUPPORT
1003 vstfx_get_info_lx (char* dllpath, enum VSTScanMode mode)
1005 return vstfx_get_info(dllpath, ARDOUR::LXVST, mode);
1009 #ifdef WINDOWS_VST_SUPPORT
1011 vstfx_get_info_fst (char* dllpath, enum VSTScanMode mode)
1013 return vstfx_get_info(dllpath, ARDOUR::Windows_VST, mode);
1017 #ifndef VST_SCANNER_APP