13
0

scan VSTs in background, allow to cancel & timeout

This commit is contained in:
Robin Gareus 2014-02-25 13:11:07 +01:00
parent 30de04a58c
commit 0708721b4f
3 changed files with 15 additions and 3 deletions

View File

@ -56,6 +56,8 @@ class LIBARDOUR_API PluginManager : public boost::noncopyable {
void clear_vst_cache ();
void clear_vst_blacklist ();
bool cancelled () { return cancel_scan; }
int add_windows_vst_directory (std::string dirpath);
int add_lxvst_directory (std::string dirpath);

View File

@ -187,6 +187,7 @@ PluginManager::refresh (bool cache_only)
{
DEBUG_TRACE (DEBUG::PluginManager, "PluginManager::refresh\n");
BootMessage (_("Discovering Plugins"));
cancel_scan = false;
ladspa_refresh ();
#ifdef LV2_SUPPORT
@ -210,12 +211,13 @@ PluginManager::refresh (bool cache_only)
PluginListChanged (); /* EMIT SIGNAL */
PluginScanMessage(X_("closeme"), "");
cancel_scan = false;
}
void
PluginManager::cancel_plugin_scan ()
{
// TODO
cancel_scan = true;
}
void
@ -661,6 +663,7 @@ PluginManager::windows_vst_discover_from_path (string path, bool cache_only)
if (plugin_objects) {
for (x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
if (cancelled()) break;
ARDOUR::PluginScanMessage(_("VST"), **x);
windows_vst_discover (**x, cache_only);
}
@ -800,6 +803,7 @@ PluginManager::lxvst_discover_from_path (string path, bool cache_only)
if (plugin_objects) {
for (x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
if (cancelled()) break;
ARDOUR::PluginScanMessage(_("LXVST"), **x);
lxvst_discover (**x, cache_only);
}

View File

@ -52,6 +52,7 @@
#include "ardour/vst_info_file.h"
#define MAX_STRING_LEN 256
#define PLUGIN_SCAN_TIMEOUT (600) // in deciseconds
using namespace std;
@ -746,8 +747,13 @@ vstfx_get_info (const char* dllpath, int type, enum VSTScanMode mode)
PBD::error << "Cannot launch VST scanner app '" << scanner_bin_path << "': "<< strerror(errno) << endmsg;
return infos;
} else {
// TODO idle loop (emit signal to GUI to call gtk_main_iteration()) check cancel.
scanner.wait();
int timeout = PLUGIN_SCAN_TIMEOUT;
while (scanner.is_running() && --timeout) {
ARDOUR::GUIIdle();
Glib::usleep (100000);
if (ARDOUR::PluginManager::instance().cancelled()) break;
}
scanner.terminate();
}
/* re-read index */
vstfx_clear_info_list(infos);