diff options
author | Robin Gareus <robin@gareus.org> | 2014-02-25 13:11:07 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-02-25 14:57:59 +0100 |
commit | 0708721b4f9fca3967a6f1c436717ff2aca0baec (patch) | |
tree | 6b9bb5051d10b5c1728a9643bda229bc38be9fee /libs/ardour/vst_info_file.cc | |
parent | 30de04a58ccab82d00ff87ebdd2cece6c0aa388b (diff) |
scan VSTs in background, allow to cancel & timeout
Diffstat (limited to 'libs/ardour/vst_info_file.cc')
-rw-r--r-- | libs/ardour/vst_info_file.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc index 8bb3f4aa7a..fac3f199bc 100644 --- a/libs/ardour/vst_info_file.cc +++ b/libs/ardour/vst_info_file.cc @@ -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); |