#include <stddef.h>
#include <stdio.h>
#include <string.h>
-#include <libgen.h>
#include <glib.h>
#include <glib/gstdio.h>
#include "pbd/error.h"
#ifndef VST_SCANNER_APP
-#include "pbd/system_exec.h"
#include "ardour/plugin_manager.h" // scanner_bin_path
+#include "ardour/rc_configuration.h"
+#include "ardour/system_exec.h"
#endif
#include "ardour/filesystem_paths.h"
#include "ardour/vst_info_file.h"
#define MAX_STRING_LEN 256
-#define PLUGIN_SCAN_TIMEOUT (600) // in deciseconds
+#define PLUGIN_SCAN_TIMEOUT (Config->get_vst_scan_timeout()) // in deciseconds
/* CACHE FILE PATHS */
return vstfx_cache_file(dllpath, personal, EXT_INFOFILE);
}
+#ifndef VST_SCANNER_APP
static string
vstfx_errorfile_path (const char* dllpath, int personal)
{
return vstfx_cache_file(dllpath, personal, EXT_ERRORFILE);
}
-
+#endif
/* *** MEMORY MANAGEMENT *** */
} else {
int plugin_cnt = 0;
vstfx_free_info(info);
- if (read_int (fp, &plugin_cnt)) {
+ if (!read_int (fp, &plugin_cnt)) {
for (int i = 0; i < plugin_cnt; i++) {
if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
vstfx_clear_info_list(infos);
simple_master_callback (AEffect *, int32_t opcode, int32_t, intptr_t, void *ptr, float)
{
const char* vstfx_can_do_strings[] = {
+ "supplyIdle",
+ "sendVstTimeInfo",
+ "sendVstEvents",
+ "sendVstMidiEvent",
+ "receiveVstEvents",
+ "receiveVstMidiEvent",
"supportShell",
- "shellCategory"
+ "shellCategory",
+ "shellCategorycurID"
};
- const int vstfx_can_do_string_count = 2;
+ const int vstfx_can_do_string_count = 9;
if (opcode == audioMasterVersion) {
return 2400;
fail to implement getVendorString, and so won't stuff the
string with any name*/
- char creator[65] = "Unknown\0";
+ char creator[65] = "Unknown";
+ char name[65] = "";
AEffect* plugin = vstfx->plugin;
- info->name = strdup (vstfx->handle->name);
+
+ plugin->dispatcher (plugin, effGetEffectName, 0, 0, name, 0);
+
+ if (strlen(name) == 0) {
+ plugin->dispatcher (plugin, effGetProductString, 0, 0, name, 0);
+ }
+
+ if (strlen(name) == 0) {
+ info->name = strdup (vstfx->handle->name);
+ } else {
+ info->name = strdup (name);
+ }
/*If the plugin doesn't bother to implement GetVendorString we will
- have pre-stuffed the string with 'Unkown' */
+ have pre-stuffed the string with 'Unknown' */
plugin->dispatcher (plugin, effGetVendorString, 0, 0, creator, 0);
string path = vstfx->handle->path;
do {
- char name[65] = "Unknown\0";
+ char name[65] = "Unknown";
id = plugin->dispatcher (plugin, effShellGetNextPlugin, 0, 0, name, 0);
ids.push_back(std::make_pair(id, name));
} while ( id != 0 );
}
}
}
+ } else {
+ switch(type) {
+#ifdef WINDOWS_VST_SUPPORT
+ case ARDOUR::Windows_VST: fst_close(vstfx); break;
+#endif
+#ifdef LXVST_SUPPORT
+ case ARDOUR::LXVST: vstfx_close (vstfx); break;
+#endif
+ default: assert(0); break;
+ }
}
#endif
}
vstfx_info_from_plugin(dllpath, vstfx, infos, ARDOUR::LXVST);
- vstfx_close (vstfx);
vstfx_unload (h);
return true;
}
vstfx_info_from_plugin(dllpath, vstfx, infos, ARDOUR::Windows_VST);
- fst_close(vstfx);
- //fst_unload(&h); // XXX -> fst_close()
return true;
}
#endif
argp[2] = 0;
set_error_log(dllpath);
- PBD::SystemExec scanner (scanner_bin_path, argp);
+ ARDOUR::SystemExec scanner (scanner_bin_path, argp);
PBD::ScopedConnectionList cons;
scanner.ReadStdout.connect_same_thread (cons, boost::bind (&parse_scanner_output, _1 ,_2));
if (scanner.start (2 /* send stderr&stdout via signal */)) {
return infos;
} else {
int timeout = PLUGIN_SCAN_TIMEOUT;
- while (scanner.is_running() && --timeout) {
+ bool no_timeout = (timeout <= 0);
+ ARDOUR::PluginScanTimeout(timeout);
+ while (scanner.is_running() && (no_timeout || timeout > 0)) {
+ if (!no_timeout && !ARDOUR::PluginManager::instance().no_timeout()) {
+ if (timeout%5 == 0) {
+ ARDOUR::PluginScanTimeout(timeout);
+ }
+ --timeout;
+ }
ARDOUR::GUIIdle();
Glib::usleep (100000);