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 #ifdef PLATFORM_WINDOWS
65 #define PFX_DOTFILE ""
67 #define PFX_DOTFILE "."
72 #ifndef VST_SCANNER_APP
77 #ifdef WINDOWS_VST_SUPPORT
80 vstfx_instantiate_and_get_info_fst (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID);
84 static bool vstfx_instantiate_and_get_info_lx (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID);
87 /* ID for shell plugins */
88 static int vstfx_current_loading_id = 0;
92 /* *** CACHE FILE PATHS *** */
95 vstfx_cache_file (const char* dllpath, int personal, const char *ext)
99 dir = get_personal_vst_blacklist_dir();
101 dir = Glib::path_get_dirname (std::string(dllpath));
105 s << PFX_DOTFILE << Glib::path_get_basename (dllpath) << ext;
106 return Glib::build_filename (dir, s.str ());
110 vstfx_blacklist_path (const char* dllpath, int personal)
112 return vstfx_cache_file(dllpath, personal, EXT_BLACKLIST);
116 vstfx_infofile_path (const char* dllpath, int personal)
118 return vstfx_cache_file(dllpath, personal, EXT_INFOFILE);
122 vstfx_errorfile_path (const char* dllpath, int personal)
124 return vstfx_cache_file(dllpath, personal, EXT_ERRORFILE);
129 /* *** MEMORY MANAGEMENT *** */
131 /** cleanup single allocated VSTInfo */
133 vstfx_free_info (VSTInfo *info)
135 for (int i = 0; i < info->numParams; i++) {
136 free (info->ParamNames[i]);
137 free (info->ParamLabels[i]);
141 free (info->creator);
142 free (info->Category);
143 free (info->ParamNames);
144 free (info->ParamLabels);
150 vstfx_clear_info_list (vector<VSTInfo *> *infos)
152 for (vector<VSTInfo *>::iterator i = infos->begin(); i != infos->end(); ++i) {
160 /* *** CACHE FILE I/O *** */
162 /** Helper function to read a line from the cache file
163 * @return newly allocated string of NULL
166 read_string (FILE *fp)
168 char buf[MAX_STRING_LEN];
170 if (!fgets (buf, MAX_STRING_LEN, fp)) {
174 if (strlen(buf) < MAX_STRING_LEN) {
176 buf[strlen(buf)-1] = 0;
184 /** Read an integer value from a line in fp into n,
185 * @return true on failure, false on success.
188 read_int (FILE* fp, int* n)
190 char buf[MAX_STRING_LEN];
192 char* p = fgets (buf, MAX_STRING_LEN, fp);
197 return (sscanf (p, "%d", n) != 1);
200 /** parse a plugin-block from the cache info file */
202 vstfx_load_info_block(FILE* fp, VSTInfo *info)
204 if ((info->name = read_string(fp)) == 0) return false;
205 if ((info->creator = read_string(fp)) == 0) return false;
206 if (read_int (fp, &info->UniqueID)) return false;
207 if ((info->Category = read_string(fp)) == 0) return false;
208 if (read_int (fp, &info->numInputs)) return false;
209 if (read_int (fp, &info->numOutputs)) return false;
210 if (read_int (fp, &info->numParams)) return false;
211 if (read_int (fp, &info->wantMidi)) return false;
212 if (read_int (fp, &info->hasEditor)) return false;
213 if (read_int (fp, &info->canProcessReplacing)) return false;
215 /* backwards compatibility with old .fsi files */
216 if (info->wantMidi == -1) {
220 if ((info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams)) == 0) {
224 for (int i = 0; i < info->numParams; ++i) {
225 if ((info->ParamNames[i] = read_string(fp)) == 0) return false;
228 if ((info->ParamLabels = (char **) malloc(sizeof(char*)*info->numParams)) == 0) {
232 for (int i = 0; i < info->numParams; ++i) {
233 if ((info->ParamLabels[i] = read_string(fp)) == 0) {
240 /** parse all blocks in a cache info file */
242 vstfx_load_info_file (FILE* fp, vector<VSTInfo*> *infos)
245 if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
248 if (vstfx_load_info_block(fp, info)) {
249 if (strncmp (info->Category, "Shell", 5)) {
250 infos->push_back(info);
253 vstfx_free_info(info);
254 if (read_int (fp, &plugin_cnt)) {
255 for (int i = 0; i < plugin_cnt; i++) {
256 if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
257 vstfx_clear_info_list(infos);
260 if (vstfx_load_info_block(fp, info)) {
261 infos->push_back(info);
263 vstfx_free_info(info);
264 vstfx_clear_info_list(infos);
269 return false; /* Bad file */
274 vstfx_free_info(info);
275 vstfx_clear_info_list(infos);
280 vstfx_write_info_block (FILE* fp, VSTInfo *info)
285 fprintf (fp, "%s\n", info->name);
286 fprintf (fp, "%s\n", info->creator);
287 fprintf (fp, "%d\n", info->UniqueID);
288 fprintf (fp, "%s\n", info->Category);
289 fprintf (fp, "%d\n", info->numInputs);
290 fprintf (fp, "%d\n", info->numOutputs);
291 fprintf (fp, "%d\n", info->numParams);
292 fprintf (fp, "%d\n", info->wantMidi);
293 fprintf (fp, "%d\n", info->hasEditor);
294 fprintf (fp, "%d\n", info->canProcessReplacing);
296 for (int i = 0; i < info->numParams; i++) {
297 fprintf (fp, "%s\n", info->ParamNames[i]);
300 for (int i = 0; i < info->numParams; i++) {
301 fprintf (fp, "%s\n", info->ParamLabels[i]);
306 vstfx_write_info_file (FILE* fp, vector<VSTInfo *> *infos)
311 if (infos->size() > 1) {
312 vector<VSTInfo *>::iterator x = infos->begin();
313 /* write out the shell info first along with count of the number of
314 * plugins contained in this shell
316 vstfx_write_info_block(fp, *x);
317 fprintf( fp, "%d\n", (int)infos->size() - 1 );
319 /* Now write out the info for each plugin */
320 for (; x != infos->end(); ++x) {
321 vstfx_write_info_block(fp, *x);
323 } else if (infos->size() == 1) {
324 vstfx_write_info_block(fp, infos->front());
326 PBD::error << "Zero plugins in VST." << endmsg; // XXX here? rather make this impossible before if it ain't already.
331 /* *** CACHE AND BLACKLIST MANAGEMENT *** */
333 /* return true if plugin is blacklisted or has an invalid file extension */
335 vstfx_blacklist_stat (const char *dllpath, int personal)
337 if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) {
340 string const path = vstfx_blacklist_path (dllpath, personal);
342 if (Glib::file_test (path, Glib::FileTest (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR))) {
346 if (stat (dllpath, &dllstat) == 0 && stat (path.c_str(), &fsbstat) == 0) {
347 if (dllstat.st_mtime > fsbstat.st_mtime) {
348 /* plugin is newer than blacklist file */
352 /* stat failed or plugin is older than blacklist file */
355 /* blacklist file does not exist */
359 /* return true if plugin is blacklisted, checks both personal
360 * and global folder */
362 vstfx_check_blacklist (const char *dllpath)
364 if (vstfx_blacklist_stat(dllpath, 0)) return true;
365 if (vstfx_blacklist_stat(dllpath, 1)) return true;
369 /* create blacklist file, preferably in same folder as the
370 * plugin, fall back to personal folder in $HOME
373 vstfx_blacklist_file (const char *dllpath)
376 if ((f = fopen (vstfx_blacklist_path (dllpath, 0).c_str(), "w"))) {
379 return fopen (vstfx_blacklist_path (dllpath, 1).c_str(), "w");
382 /** mark plugin as blacklisted */
384 vstfx_blacklist (const char *dllpath)
386 FILE *f = vstfx_blacklist_file(dllpath);
394 /** mark plugin as not blacklisted */
396 vstfx_un_blacklist (const char *dllpath)
398 ::g_unlink(vstfx_blacklist_path (dllpath, 0).c_str());
399 ::g_unlink(vstfx_blacklist_path (dllpath, 1).c_str());
402 /** remove info file from cache */
404 vstfx_remove_infofile (const char *dllpath)
406 ::g_unlink(vstfx_infofile_path (dllpath, 0).c_str());
407 ::g_unlink(vstfx_infofile_path (dllpath, 1).c_str());
410 /** helper function, check if cache is newer than plugin
411 * @return path to cache file */
413 vstfx_infofile_stat (const char *dllpath, struct stat* statbuf, int personal)
415 if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) {
419 string const path = vstfx_infofile_path (dllpath, personal);
421 if (Glib::file_test (path, Glib::FileTest (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR))) {
425 if (stat (dllpath, &dllstat) == 0) {
426 if (stat (path.c_str(), statbuf) == 0) {
427 if (dllstat.st_mtime <= statbuf->st_mtime) {
428 /* plugin is older than info file */
429 return strdup (path.c_str ());
438 /** cache file for given plugin
439 * @return FILE of the .fsi cache if found and up-to-date*/
441 vstfx_infofile_for_read (const char* dllpath)
443 struct stat own_statbuf;
444 struct stat sys_statbuf;
447 char* own_info = vstfx_infofile_stat (dllpath, &own_statbuf, 1);
448 char* sys_info = vstfx_infofile_stat (dllpath, &sys_statbuf, 0);
452 if (own_statbuf.st_mtime <= sys_statbuf.st_mtime) {
453 /* system info file is newer, use it */
454 rv = g_fopen (sys_info, "rb");
457 rv = g_fopen (own_info, "rb");
459 } else if (sys_info) {
460 rv = g_fopen (sys_info, "rb");
468 /** helper function for \ref vstfx_infofile_for_write
469 * abstract global and personal cache folders
472 vstfx_infofile_create (const char* dllpath, int personal)
474 if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) {
478 string const path = vstfx_infofile_path (dllpath, personal);
479 return fopen (path.c_str(), "w");
482 /** newly created cache file for given plugin
483 * @return FILE for the .fsi cache, NULL if neither personal,
484 * nor global cache folder is writable */
486 vstfx_infofile_for_write (const char* dllpath)
490 if ((f = vstfx_infofile_create (dllpath, 0)) == 0) {
491 f = vstfx_infofile_create (dllpath, 1);
497 /** check if cache-file exists, is up-to-date and parse cache file
498 * @param infos [return] loaded plugin info
499 * @return true if .fsi cache was read successfully, false otherwise
502 vstfx_get_info_from_file(const char* dllpath, vector<VSTInfo*> *infos)
506 if ((infofile = vstfx_infofile_for_read (dllpath)) != 0) {
507 rv = vstfx_load_info_file(infofile, infos);
510 PBD::warning << "Cannot get VST information form " << dllpath << ": info file load failed." << endmsg;
518 /* *** VST system-under-test methods *** */
521 bool vstfx_midi_input (VSTState* vstfx)
523 AEffect* plugin = vstfx->plugin;
525 int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
527 if (vst_version >= 2) {
528 /* should we send it VST events (i.e. MIDI) */
530 if ((plugin->flags & effFlagsIsSynth) || (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "receiveVstEvents", 0.0f) > 0)) {
539 bool vstfx_midi_output (VSTState* vstfx)
541 AEffect* plugin = vstfx->plugin;
543 int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
545 if (vst_version >= 2) {
546 /* should we send it VST events (i.e. MIDI) */
548 if ( (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "sendVstEvents", 0.0f) > 0)
549 || (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "sendVstMidiEvent", 0.0f) > 0)
558 /** simple 'dummy' audiomaster callback to instantiate the plugin
559 * and query information
562 simple_master_callback (AEffect *, int32_t opcode, int32_t, intptr_t, void *ptr, float)
564 const char* vstfx_can_do_strings[] = {
568 const int vstfx_can_do_string_count = 2;
570 if (opcode == audioMasterVersion) {
573 else if (opcode == audioMasterCanDo) {
574 for (int i = 0; i < vstfx_can_do_string_count; i++) {
575 if (! strcmp(vstfx_can_do_strings[i], (const char*)ptr)) {
581 else if (opcode == audioMasterCurrentId) {
582 return vstfx_current_loading_id;
590 /** main plugin query and test function */
592 vstfx_parse_vst_state (VSTState* vstfx)
596 VSTInfo* info = (VSTInfo*) malloc (sizeof (VSTInfo));
601 /*We need to init the creator because some plugins
602 fail to implement getVendorString, and so won't stuff the
603 string with any name*/
605 char creator[65] = "Unknown\0";
607 AEffect* plugin = vstfx->plugin;
609 info->name = strdup (vstfx->handle->name);
611 /*If the plugin doesn't bother to implement GetVendorString we will
612 have pre-stuffed the string with 'Unkown' */
614 plugin->dispatcher (plugin, effGetVendorString, 0, 0, creator, 0);
616 /*Some plugins DO implement GetVendorString, but DON'T put a name in it
617 so if its just a zero length string we replace it with 'Unknown' */
619 if (strlen(creator) == 0) {
620 info->creator = strdup ("Unknown");
622 info->creator = strdup (creator);
626 switch (plugin->dispatcher (plugin, effGetPlugCategory, 0, 0, 0, 0))
628 case kPlugCategEffect: info->Category = strdup ("Effect"); break;
629 case kPlugCategSynth: info->Category = strdup ("Synth"); break;
630 case kPlugCategAnalysis: info->Category = strdup ("Anaylsis"); break;
631 case kPlugCategMastering: info->Category = strdup ("Mastering"); break;
632 case kPlugCategSpacializer: info->Category = strdup ("Spacializer"); break;
633 case kPlugCategRoomFx: info->Category = strdup ("RoomFx"); break;
634 case kPlugSurroundFx: info->Category = strdup ("SurroundFx"); break;
635 case kPlugCategRestoration: info->Category = strdup ("Restoration"); break;
636 case kPlugCategOfflineProcess: info->Category = strdup ("Offline"); break;
637 case kPlugCategShell: info->Category = strdup ("Shell"); break;
638 case kPlugCategGenerator: info->Category = strdup ("Generator"); break;
639 default: info->Category = strdup ("Unknown"); break;
642 info->UniqueID = plugin->uniqueID;
644 info->numInputs = plugin->numInputs;
645 info->numOutputs = plugin->numOutputs;
646 info->numParams = plugin->numParams;
647 info->wantMidi = (vstfx_midi_input(vstfx) ? 1 : 0) | (vstfx_midi_output(vstfx) ? 2 : 0);
648 info->hasEditor = plugin->flags & effFlagsHasEditor ? true : false;
649 info->canProcessReplacing = plugin->flags & effFlagsCanReplacing ? true : false;
650 info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams);
651 info->ParamLabels = (char **) malloc(sizeof(char*)*info->numParams);
653 for (int i = 0; i < info->numParams; ++i) {
657 /* Not all plugins give parameters labels as well as names */
659 strcpy (name, "No Name");
660 strcpy (label, "No Label");
662 plugin->dispatcher (plugin, effGetParamName, i, 0, name, 0);
663 info->ParamNames[i] = strdup(name);
665 //NOTE: 'effGetParamLabel' is no longer defined in vestige headers
666 //plugin->dispatcher (plugin, effGetParamLabel, i, 0, label, 0);
667 info->ParamLabels[i] = strdup(label);
672 /** wrapper around \ref vstfx_parse_vst_state,
673 * iterate over plugins in shell, translate VST-info into ardour VSTState
676 vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *> *infos, enum ARDOUR::PluginType type)
681 if (!(info = vstfx_parse_vst_state(vstfx))) {
685 infos->push_back(info);
686 #if 1 // shell-plugin support
687 /* If this plugin is a Shell and we are not already inside a shell plugin
688 * read the info for all of the plugins contained in this shell.
690 if (!strncmp (info->Category, "Shell", 5)
691 && vstfx->handle->plugincnt == 1) {
693 vector< pair<int, string> > ids;
694 AEffect *plugin = vstfx->plugin;
695 string path = vstfx->handle->path;
698 char name[65] = "Unknown\0";
699 id = plugin->dispatcher (plugin, effShellGetNextPlugin, 0, 0, name, 0);
700 ids.push_back(std::make_pair(id, name));
704 #ifdef WINDOWS_VST_SUPPORT
705 case 1: fst_close(vstfx); break;
708 case 2: vstfx_close (vstfx); break;
710 default: assert(0); break;
713 for (vector< pair<int, string> >::iterator x = ids.begin(); x != ids.end(); ++x) {
715 if (id == 0) continue;
716 /* recurse vstfx_get_info() */
720 #ifdef WINDOWS_VST_SUPPORT
721 case ARDOUR::Windows_VST: ok = vstfx_instantiate_and_get_info_fst(dllpath, infos, id); break;
724 case ARDOUR::LXVST: ok = vstfx_instantiate_and_get_info_lx(dllpath, infos, id); break;
729 // One shell (some?, all?) does not report the actual plugin name
730 // even after the shelled plugin has been instantiated.
731 // Replace the name of the shell with the real name.
732 info = infos->back();
735 if ((*x).second.length() == 0) {
736 info->name = strdup("Unknown");
739 info->name = strdup ((*x).second.c_str());
749 /* *** TOP-LEVEL PLUGIN INSTANTIATION FUNCTIONS *** */
753 vstfx_instantiate_and_get_info_lx (
754 const char* dllpath, vector<VSTInfo*> *infos, int uniqueID)
758 if (!(h = vstfx_load(dllpath))) {
759 PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": load failed." << endmsg;
763 vstfx_current_loading_id = uniqueID;
765 if (!(vstfx = vstfx_instantiate(h, simple_master_callback, 0))) {
767 PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": instantiation failed." << endmsg;
771 vstfx_current_loading_id = 0;
773 vstfx_info_from_plugin(dllpath, vstfx, infos, ARDOUR::LXVST);
781 #ifdef WINDOWS_VST_SUPPORT
783 vstfx_instantiate_and_get_info_fst (
784 const char* dllpath, vector<VSTInfo*> *infos, int uniqueID)
788 if(!(h = fst_load(dllpath))) {
789 PBD::warning << "Cannot get Windows VST information from " << dllpath << ": load failed." << endmsg;
793 vstfx_current_loading_id = uniqueID;
795 if(!(vstfx = fst_instantiate(h, simple_master_callback, 0))) {
797 vstfx_current_loading_id = 0;
798 PBD::warning << "Cannot get Windows VST information from " << dllpath << ": instantiation failed." << endmsg;
801 vstfx_current_loading_id = 0;
803 vstfx_info_from_plugin(dllpath, vstfx, infos, ARDOUR::Windows_VST);
806 //fst_unload(&h); // XXX -> fst_close()
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;
827 if (!(_errorlog_fd = fopen(vstfx_errorfile_path(_errorlog_dll, 0).c_str(), "w"))) {
828 if (!(_errorlog_fd = fopen(vstfx_errorfile_path(_errorlog_dll, 1).c_str(), "w"))) {
829 PBD::error << "Cannot create plugin error-log for plugin " << _errorlog_dll;
831 _errorlog_dll = NULL;
837 fprintf (_errorlog_fd, "%s\n", msg.c_str());
839 PBD::error << "VST scanner: " << msg;
844 set_error_log (const char* dllpath) {
845 assert(!_errorlog_fd);
846 assert(!_errorlog_dll);
847 _errorlog_dll = strdup(dllpath);
853 fclose(_errorlog_fd);
863 /* *** THE MAIN FUNCTION THAT USES ALL OF THE ABOVE :) *** */
865 static vector<VSTInfo *> *
866 vstfx_get_info (const char* dllpath, enum ARDOUR::PluginType type, enum VSTScanMode mode)
869 vector<VSTInfo*> *infos = new vector<VSTInfo*>;
871 if (vstfx_check_blacklist(dllpath)) {
875 if (vstfx_get_info_from_file(dllpath, infos)) {
879 #ifndef VST_SCANNER_APP
880 std::string scanner_bin_path = ARDOUR::PluginManager::scanner_bin_path;
882 if (mode == VST_SCAN_CACHE_ONLY) {
883 /* never scan explicitly, use cache only */
886 else if (mode == VST_SCAN_USE_APP && scanner_bin_path != "") {
887 /* use external scanner app */
889 char **argp= (char**) calloc(3,sizeof(char*));
890 argp[0] = strdup(scanner_bin_path.c_str());
891 argp[1] = strdup(dllpath);
894 set_error_log(dllpath);
895 PBD::SystemExec scanner (scanner_bin_path, argp);
896 PBD::ScopedConnectionList cons;
897 scanner.ReadStdout.connect_same_thread (cons, boost::bind (&parse_scanner_output, _1 ,_2));
898 if (scanner.start (2 /* send stderr&stdout via signal */)) {
899 PBD::error << "Cannot launch VST scanner app '" << scanner_bin_path << "': "<< strerror(errno) << endmsg;
903 int timeout = PLUGIN_SCAN_TIMEOUT;
904 while (scanner.is_running() && --timeout) {
906 Glib::usleep (100000);
908 if (ARDOUR::PluginManager::instance().cancelled()) {
909 // remove info file (might be incomplete)
910 vstfx_remove_infofile(dllpath);
911 // remove temporary blacklist file (scan incomplete)
912 vstfx_un_blacklist(dllpath);
921 /* re-read index (generated by external scanner) */
922 vstfx_clear_info_list(infos);
923 if (!vstfx_check_blacklist(dllpath)) {
924 vstfx_get_info_from_file(dllpath, infos);
928 /* else .. instantiate and check in in ardour process itself */
930 (void) mode; // unused parameter
934 /* blacklist in case instantiation fails */
935 vstfx_blacklist(dllpath);
938 #ifdef WINDOWS_VST_SUPPORT
939 case ARDOUR::Windows_VST: ok = vstfx_instantiate_and_get_info_fst(dllpath, infos, 0); break;
942 case ARDOUR::LXVST: ok = vstfx_instantiate_and_get_info_lx(dllpath, infos, 0); break;
951 /* remove from blacklist */
952 vstfx_un_blacklist(dllpath);
954 /* crate cache/whitelist */
955 infofile = vstfx_infofile_for_write (dllpath);
957 PBD::warning << "Cannot cache VST information for " << dllpath << ": cannot create new FST info file." << endmsg;
960 vstfx_write_info_file (infofile, infos);
968 /* *** public API *** */
971 vstfx_free_info_list (vector<VSTInfo *> *infos)
973 for (vector<VSTInfo *>::iterator i = infos->begin(); i != infos->end(); ++i) {
980 get_personal_vst_blacklist_dir() {
981 string dir = Glib::build_filename (ARDOUR::user_cache_directory(), "fst_blacklist");
982 /* if the directory doesn't exist, try to create it */
983 if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
984 if (g_mkdir (dir.c_str (), 0700)) {
985 PBD::error << "Cannot create VST blacklist folder '" << dir << "'" << endmsg;
993 get_personal_vst_info_cache_dir() {
994 string dir = Glib::build_filename (ARDOUR::user_cache_directory(), "fst_info");
995 /* if the directory doesn't exist, try to create it */
996 if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
997 if (g_mkdir (dir.c_str (), 0700)) {
998 PBD::error << "Cannot create VST info folder '" << dir << "'" << endmsg;
1005 #ifdef LXVST_SUPPORT
1007 vstfx_get_info_lx (char* dllpath, enum VSTScanMode mode)
1009 return vstfx_get_info(dllpath, ARDOUR::LXVST, mode);
1013 #ifdef WINDOWS_VST_SUPPORT
1015 vstfx_get_info_fst (char* dllpath, enum VSTScanMode mode)
1017 return vstfx_get_info(dllpath, ARDOUR::Windows_VST, mode);
1021 #ifndef VST_SCANNER_APP