From 1e6694f41af3ba3b25fb19ed802f6806b0b6f0ef Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 25 Feb 2012 20:43:14 +0000 Subject: [PATCH] Use FastScreenUpdate for UI message updating, and only if plugin has message output ports. git-svn-id: svn://localhost/ardour2/branches/3.0@11521 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/lv2_plugin_ui.cc | 9 +++++---- gtk2_ardour/lv2_plugin_ui.h | 2 +- libs/ardour/ardour/lv2_plugin.h | 1 + libs/ardour/lv2_plugin.cc | 11 +++++++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc index 7cf230e4ec..7524b6b5de 100644 --- a/gtk2_ardour/lv2_plugin_ui.cc +++ b/gtk2_ardour/lv2_plugin_ui.cc @@ -73,11 +73,10 @@ LV2PluginUI::write_to_ui(void* controller, port_index, buffer_size, format, buffer); } -bool +void LV2PluginUI::update_timeout() { _lv2->emit_to_ui(this, &LV2PluginUI::write_to_ui); - return true; } void @@ -267,8 +266,10 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title) } } - Glib::signal_timeout().connect( - sigc::mem_fun(*this, &LV2PluginUI::update_timeout), 500); + if (_lv2->has_message_output()) { + ARDOUR_UI::instance()->RapidScreenUpdate.connect( + sigc::mem_fun(*this, &LV2PluginUI::update_timeout)); + } } void diff --git a/gtk2_ardour/lv2_plugin_ui.h b/gtk2_ardour/lv2_plugin_ui.h index 071ad2a1dc..7284f82128 100644 --- a/gtk2_ardour/lv2_plugin_ui.h +++ b/gtk2_ardour/lv2_plugin_ui.h @@ -90,7 +90,7 @@ class LV2PluginUI : public PlugUIBase, public Gtk::VBox uint32_t format, const void* buffer); - bool update_timeout(); + void update_timeout(); void lv2ui_instantiate(const std::string& title); void lv2ui_free(); diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index 65b63269e1..cf764b34d2 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -113,6 +113,7 @@ class LV2Plugin : public ARDOUR::Plugin std::string current_preset () const; bool has_editor () const; + bool has_message_output () const; uint32_t atom_eventTransfer() const; diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 2907c2f904..d74d23acc2 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -763,6 +763,17 @@ LV2Plugin::has_editor() const return _impl->ui != NULL; } +bool +LV2Plugin::has_message_output() const +{ + for (uint32_t i = 0; i < num_ports(); ++i) { + if ((_port_flags[i] & PORT_MESSAGE) && _port_flags[i] & PORT_OUTPUT) { + return true; + } + } + return false; +} + uint32_t LV2Plugin::atom_eventTransfer() const {