plugin scan progress-display & preferences

This commit is contained in:
Robin Gareus 2014-02-24 03:53:53 +01:00
parent 22905d8a93
commit 59cc85b821
7 changed files with 190 additions and 11 deletions

View File

@ -72,6 +72,7 @@
#include "ardour/filename_extensions.h"
#include "ardour/filesystem_paths.h"
#include "ardour/port.h"
#include "ardour/plugin_manager.h"
#include "ardour/process_thread.h"
#include "ardour/profile.h"
#include "ardour/recent_sessions.h"
@ -304,6 +305,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
ARDOUR::FileSource::AmbiguousFileName.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::ambiguous_file, this, _1, _2));
/* also plugin scan messages */
ARDOUR::PluginScanMessage.connect (forever_connections, MISSING_INVALIDATOR, boost::bind(&ARDOUR_UI::plugin_scan_dialog, this, _1, _2), gui_context());
/* lets get this party started */
setup_gtk_ardour_enums ();
@ -3790,6 +3794,41 @@ quickly enough to keep up with recording.\n"), PROGRAM_NAME));
}
}
void
ARDOUR_UI::cancel_plugin_scan ()
{
PluginManager::instance().cancel_plugin_scan();
}
static MessageDialog *scan_dlg = NULL;
void
ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin)
{
if (!Config->get_show_plugin_scan_window()) { return; }
if (!scan_dlg) {
scan_dlg = new MessageDialog("", false, MESSAGE_INFO, BUTTONS_NONE);
VBox* vbox = scan_dlg->get_vbox();
vbox->set_size_request(400,-1);
scan_dlg->set_title (_("Scanning for plugins"));
Gtk::Button *cancel_button = manage(new Gtk::Button(_("Cancel plugin scan")));
cancel_button->set_name ("EditorGTKButton");
cancel_button->signal_clicked().connect ( mem_fun (*this, &ARDOUR_UI::cancel_plugin_scan) );
scan_dlg->get_vbox()->pack_start ( *cancel_button, PACK_SHRINK);
}
if (type == X_("closeme")) {
scan_dlg->hide();
} else {
scan_dlg->set_message(type + ": " + Glib::path_get_basename(plugin));
scan_dlg->show_all();
}
gtk_main_iteration ();
}
void
ARDOUR_UI::disk_underrun_handler ()
{

View File

@ -993,6 +993,69 @@ private:
CheckButton _video_advanced_setup_button;
};
class PluginOptions : public OptionEditorBox
{
public:
PluginOptions (RCConfiguration* c)
: _rc_config (c)
, _display_plugin_scan_progress (_("Display Plugin Scan Progress"))
{
Table* t = manage (new Table (2, 6));
t->set_spacings (4);
Button* b;
b = manage (new Button (_("Clear VST Cache")));
b->signal_clicked().connect (sigc::mem_fun (*this, &PluginOptions::clear_vst_cache_clicked));
t->attach (*b, 0, 2, 0, 1, FILL);
b = manage (new Button (_("Clear VST Blacklist")));
b->signal_clicked().connect (sigc::mem_fun (*this, &PluginOptions::clear_vst_blacklist_clicked));
t->attach (*b, 0, 2, 1, 2, FILL);
b = manage (new Button (_("Refresh Plugin List")));
b->signal_clicked().connect (sigc::mem_fun (*this, &PluginOptions::refresh_clicked));
t->attach (*b, 0, 2, 2, 3, FILL);
t->attach (_display_plugin_scan_progress, 0, 2, 3, 4);
_display_plugin_scan_progress.signal_toggled().connect (sigc::mem_fun (*this, &PluginOptions::display_plugin_scan_progress_toggled));
Gtkmm2ext::UI::instance()->set_tip (_display_plugin_scan_progress,
_("<b>When enabled</b> a popup window details plugin-scan."));
_box->pack_start (*t,true,true);
}
void parameter_changed (string const & p) {
if (p == "show-plugin-scan-window") {
bool const x = _rc_config->get_show_plugin_scan_window();
_display_plugin_scan_progress.set_active (x);
}
}
void set_state_from_config () {
parameter_changed ("show-plugin-scan-window");
}
private:
RCConfiguration* _rc_config;
CheckButton _display_plugin_scan_progress;
void display_plugin_scan_progress_toggled () {
bool const x = _display_plugin_scan_progress.get_active ();
_rc_config->set_show_plugin_scan_window (x);
}
void clear_vst_cache_clicked () {
PluginManager::instance().clear_vst_cache();
}
void clear_vst_blacklist_clicked () {
PluginManager::instance().clear_vst_blacklist();
}
void refresh_clicked () {
PluginManager::instance().refresh();
}
};
/** A class which allows control of visibility of some editor components usign
* a VisibilityGroup. The caller should pass in a `dummy' VisibilityGroup
* which has the correct members, but with null widget pointers. This
@ -1929,6 +1992,11 @@ RCOptionEditor::RCOptionEditor ()
/* VIDEO Timeline */
add_option (_("Video"), new VideoTimelineOptions (_rc_config));
#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT)
/* Plugin options (currrently VST only) */
add_option (_("Plugin"), new PluginOptions (_rc_config));
#endif
/* INTERFACE */
add_option (S_("Preferences|GUI"),

View File

@ -51,6 +51,9 @@ class LIBARDOUR_API PluginManager : public boost::noncopyable {
ARDOUR::PluginInfoList &au_plugin_info ();
void refresh ();
void cancel_plugin_scan();
void clear_vst_cache ();
void clear_vst_blacklist ();
int add_windows_vst_directory (std::string dirpath);
int add_lxvst_directory (std::string dirpath);
@ -106,6 +109,8 @@ class LIBARDOUR_API PluginManager : public boost::noncopyable {
std::string windows_vst_path;
std::string lxvst_path;
bool cancel_scan;
void ladspa_refresh ();
void windows_vst_refresh ();
void lxvst_refresh ();

View File

@ -168,8 +168,6 @@ CONFIG_VARIABLE (bool, replicate_missing_region_channels, "replicate-missing-reg
CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true)
CONFIG_VARIABLE (bool, verify_remove_last_capture, "verify-remove-last-capture", true)
CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false)
CONFIG_VARIABLE (bool, use_windows_vst, "use-windows-vst", true)
CONFIG_VARIABLE (bool, use_lxvst, "use-lxvst", true)
CONFIG_VARIABLE (bool, save_history, "save-history", true)
CONFIG_VARIABLE (int32_t, saved_history_depth, "save-history-depth", 20)
CONFIG_VARIABLE (int32_t, history_depth, "history-depth", 20)
@ -179,7 +177,6 @@ CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-bac
CONFIG_VARIABLE (float, automation_interval_msecs, "automation-interval-msecs", 30)
CONFIG_VARIABLE (bool, only_copy_imported_files, "only-copy-imported-files", false)
CONFIG_VARIABLE (bool, keep_tearoffs, "keep-tearoffs", false)
CONFIG_VARIABLE (bool, new_plugins_active, "new-plugins-active", true)
CONFIG_VARIABLE (std::string, keyboard_layout, "keyboard-layout", "ansi")
CONFIG_VARIABLE (std::string, default_bindings, "default-bindings", "ardour")
CONFIG_VARIABLE (bool, default_narrow_ms, "default-narrow_ms", false)
@ -197,11 +194,18 @@ CONFIG_VARIABLE (gain_t, max_gain, "max-gain", 2.0) /* +6.0dB */
CONFIG_VARIABLE (bool, update_editor_during_summary_drag, "update-editor-during-summary-drag", true)
CONFIG_VARIABLE (bool, never_display_periodic_midi, "never-display-periodic-midi", true)
CONFIG_VARIABLE (bool, sound_midi_notes, "sound-midi-notes", false)
CONFIG_VARIABLE (bool, use_plugin_own_gui, "use-plugin-own-gui", true)
CONFIG_VARIABLE (uint32_t, max_recent_sessions, "max-recent-sessions", 10)
CONFIG_VARIABLE (double, automation_thinning_factor, "automation-thinning-factor", 20.0)
CONFIG_VARIABLE (std::string, freesound_download_dir, "freesound-download-dir", Glib::get_home_dir() + "/Freesound/snd")
/* plugin related */
CONFIG_VARIABLE (bool, new_plugins_active, "new-plugins-active", true)
CONFIG_VARIABLE (bool, use_plugin_own_gui, "use-plugin-own-gui", true)
CONFIG_VARIABLE (bool, use_windows_vst, "use-windows-vst", true)
CONFIG_VARIABLE (bool, use_lxvst, "use-lxvst", true)
CONFIG_VARIABLE (bool, show_plugin_scan_window, "show-plugin-scan-window", true)
/* denormal management */
CONFIG_VARIABLE (bool, denormal_protection, "denormal-protection", false)

View File

@ -2090,7 +2090,9 @@ LV2PluginInfo::discover()
PluginInfoList* plugs = new PluginInfoList;
const LilvPlugins* plugins = lilv_world_get_all_plugins(_world.world);
info << "LV2: Discovering " << lilv_plugins_size(plugins) << " plugins" << endmsg;
if (!Config->get_show_plugin_scan_window()) {
info << "LV2: Discovering " << lilv_plugins_size(plugins) << " plugins" << endmsg;
}
LILV_FOREACH(plugins, i, plugins) {
const LilvPlugin* p = lilv_plugins_get(plugins, i);

View File

@ -46,6 +46,7 @@
#include <cstring>
#endif //LXVST_SUPPORT
#include <glib/gstdio.h>
#include <glibmm/miscutils.h>
#include <glibmm/pattern.h>
@ -108,6 +109,7 @@ PluginManager::PluginManager ()
, _ladspa_plugin_info(0)
, _lv2_plugin_info(0)
, _au_plugin_info(0)
, cancel_scan(false)
{
char* s;
string lrdf_path;
@ -203,6 +205,69 @@ PluginManager::refresh ()
PluginScanMessage(X_("closeme"), "");
}
void
PluginManager::cancel_plugin_scan ()
{
// TODO
}
void
PluginManager::clear_vst_cache ()
{
// see also libs/ardour/vst_info_file.cc - vstfx_infofile_path()
#ifdef WINDOWS_VST_SUPPORT
{
PathScanner scanner;
vector<string *> *fsi_files;
fsi_files = scanner (windows_vst_path, "\\.fsi$", true, true, -1, false);
if (fsi_files) {
for (vector<string *>::iterator i = fsi_files->begin(); i != fsi_files->end (); ++i) {
::g_unlink((*i)->c_str());
}
}
vector_delete(fsi_files);
}
#endif
#ifdef LXVST_SUPPORT
{
PathScanner scanner;
vector<string *> *fsi_files;
fsi_files = scanner (lxvst_path, "\\.fsi$", true, true, -1, false);
if (fsi_files) {
for (vector<string *>::iterator i = fsi_files->begin(); i != fsi_files->end (); ++i) {
::g_unlink((*i)->c_str());
}
}
vector_delete(fsi_files);
}
#endif
#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT)
{
string personal;
personal = Glib::build_filename (Glib::get_home_dir (), ".fst");
PathScanner scanner;
vector<string *> *fsi_files;
fsi_files = scanner (personal, "\\.fsi$", true, true, -1, false);
if (fsi_files) {
for (vector<string *>::iterator i = fsi_files->begin(); i != fsi_files->end (); ++i) {
::g_unlink((*i)->c_str());
}
}
vector_delete(fsi_files);
}
#endif
}
void
PluginManager::clear_vst_blacklist ()
{
// TODO -> libs/ardour/vst_info_file.cc
}
void
PluginManager::ladspa_refresh ()
{
@ -567,7 +632,6 @@ PluginManager::windows_vst_discover (string path)
if (finfos->empty()) {
DEBUG_TRACE (DEBUG::PluginManager, string_compose ("Cannot get Windows VST information from '%1'\n", path));
warning << "Cannot get Windows VST information from " << path << endmsg;
return -1;
}
@ -706,7 +770,6 @@ PluginManager::lxvst_discover (string path)
if (finfos->empty()) {
DEBUG_TRACE (DEBUG::PluginManager, string_compose ("Cannot get Linux VST information from '%1'\n", path));
warning << "Cannot get Linux VST information from " << path << endmsg;
return -1;
}

View File

@ -610,7 +610,7 @@ vstfx_instantiate_and_get_info_fst (
VSTHandle* h;
VSTState* vstfx;
if(!(h = fst_load(dllpath))) {
PBD::warning << "Cannot get VST information from " << dllpath << ": load failed." << endmsg;
PBD::warning << "Cannot get Windows VST information from " << dllpath << ": load failed." << endmsg;
return false;
}
@ -619,7 +619,7 @@ vstfx_instantiate_and_get_info_fst (
if(!(vstfx = fst_instantiate(h, simple_master_callback, 0))) {
fst_unload(&h);
vstfx_current_loading_id = 0;
PBD::warning << "Cannot get 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;
@ -642,7 +642,6 @@ vstfx_get_info (const char* dllpath, int type)
// TODO pre-check file extension ?
if (vstfx_get_info_from_file(dllpath, infos)) {
PBD::info << "using cache for VST plugin '" << dllpath << "'" << endmsg;
return infos;
}
@ -659,7 +658,6 @@ vstfx_get_info (const char* dllpath, int type)
}
if (!ok) {
PBD::warning << "Cannot get VST information for " << dllpath << "." << endmsg;
return infos;
}