#include <glib/gstdio.h>
#include <glibmm.h>
+#include "pbd/error.h"
-#ifdef VST_SCANNER_APP
-#define errormsg cerr
-#define warningmsg cerr
-#define endmsg endl
-#else
+#ifndef VST_SCANNER_APP
#include "ardour/plugin_manager.h" // scanner_bin_path
#include "ardour/rc_configuration.h"
#include "ardour/system_exec.h"
-#include "pbd/error.h"
-#define errormsg PBD::error
-#define warningmsg PBD::warning
#endif
#include "ardour/filesystem_paths.h"
} else if (infos->size() == 1) {
vstfx_write_info_block(fp, infos->front());
} else {
- errormsg << "Zero plugins in VST." << endmsg; // XXX here? rather make this impossible before if it ain't already.
+ PBD::error << "Zero plugins in VST." << endmsg; // XXX here? rather make this impossible before if it ain't already.
}
}
::g_unlink(vstfx_blacklist_path (dllpath, 1).c_str());
}
-#ifndef VST_SCANNER_APP
/** remove info file from cache */
static void
vstfx_remove_infofile (const char *dllpath)
::g_unlink(vstfx_infofile_path (dllpath, 0).c_str());
::g_unlink(vstfx_infofile_path (dllpath, 1).c_str());
}
-#endif
/** helper function, check if cache is newer than plugin
* @return path to cache file */
rv = vstfx_load_info_file(infofile, infos);
fclose (infofile);
if (!rv) {
- warningmsg << "Cannot get VST information form " << dllpath << ": info file load failed." << endmsg;
+ PBD::warning << "Cannot get VST information form " << dllpath << ": info file load failed." << endmsg;
}
}
return rv;
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 );
VSTHandle* h;
VSTState* vstfx;
if (!(h = vstfx_load(dllpath))) {
- warningmsg << "Cannot get LinuxVST information from " << dllpath << ": load failed." << endmsg;
+ PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": load failed." << endmsg;
return false;
}
if (!(vstfx = vstfx_instantiate(h, simple_master_callback, 0))) {
vstfx_unload(h);
- warningmsg << "Cannot get LinuxVST information from " << dllpath << ": instantiation failed." << endmsg;
+ PBD::warning << "Cannot get LinuxVST information from " << dllpath << ": instantiation failed." << endmsg;
return false;
}
VSTHandle* h;
VSTState* vstfx;
if(!(h = fst_load(dllpath))) {
- warningmsg << "Cannot get Windows VST information from " << dllpath << ": load failed." << endmsg;
+ PBD::warning << "Cannot get Windows VST information from " << dllpath << ": load failed." << endmsg;
return false;
}
if(!(vstfx = fst_instantiate(h, simple_master_callback, 0))) {
fst_unload(&h);
vstfx_current_loading_id = 0;
- warningmsg << "Cannot get Windows VST information from " << dllpath << ": instantiation failed." << endmsg;
+ PBD::warning << "Cannot get Windows VST information from " << dllpath << ": instantiation failed." << endmsg;
return false;
}
vstfx_current_loading_id = 0;
static void parse_scanner_output (std::string msg, size_t /*len*/)
{
if (!_errorlog_fd && !_errorlog_dll) {
- errormsg << "VST scanner: " << msg;
+ PBD::error << "VST scanner: " << msg;
return;
}
if (!_errorlog_fd) {
if (!(_errorlog_fd = fopen(vstfx_errorfile_path(_errorlog_dll, 0).c_str(), "w"))) {
if (!(_errorlog_fd = fopen(vstfx_errorfile_path(_errorlog_dll, 1).c_str(), "w"))) {
- errormsg << "Cannot create plugin error-log for plugin " << _errorlog_dll;
+ PBD::error << "Cannot create plugin error-log for plugin " << _errorlog_dll;
free(_errorlog_dll);
_errorlog_dll = NULL;
}
if (_errorlog_fd) {
fprintf (_errorlog_fd, "%s\n", msg.c_str());
} else {
- errormsg << "VST scanner: " << msg;
+ PBD::error << "VST scanner: " << msg;
}
}
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 */)) {
- errormsg << "Cannot launch VST scanner app '" << scanner_bin_path << "': "<< strerror(errno) << endmsg;
+ PBD::error << "Cannot launch VST scanner app '" << scanner_bin_path << "': "<< strerror(errno) << endmsg;
close_error_log();
return infos;
} else {
/* crate cache/whitelist */
infofile = vstfx_infofile_for_write (dllpath);
if (!infofile) {
- warningmsg << "Cannot cache VST information for " << dllpath << ": cannot create new FST info file." << endmsg;
+ PBD::warning << "Cannot cache VST information for " << dllpath << ": cannot create new FST info file." << endmsg;
return infos;
} else {
vstfx_write_info_file (infofile, infos);
/* if the directory doesn't exist, try to create it */
if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
if (g_mkdir (dir.c_str (), 0700)) {
- errormsg << "Cannot create VST blacklist folder '" << dir << "'" << endmsg;
+ PBD::error << "Cannot create VST blacklist folder '" << dir << "'" << endmsg;
//exit(1);
}
}
/* if the directory doesn't exist, try to create it */
if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
if (g_mkdir (dir.c_str (), 0700)) {
- errormsg << "Cannot create VST info folder '" << dir << "'" << endmsg;
+ PBD::error << "Cannot create VST info folder '" << dir << "'" << endmsg;
//exit(1);
}
}