diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-05-14 14:13:59 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-05-14 14:13:59 +0000 |
commit | bac4734a130eec3878e0ca490de92d5c6713afd3 (patch) | |
tree | 7ee7de4aad6353f32010f9e3a32d19fecb89ff7d | |
parent | 20cdab6416b1b70994ae4eb21d70856792ab1221 (diff) |
add new A/B comparison for plugins, plus ways of disabling all plugins quickly (not undoable at this time)
git-svn-id: svn://localhost/ardour2/trunk@1840 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour.menus | 7 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 43 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/redirect_box.cc | 48 | ||||
-rw-r--r-- | gtk2_ardour/redirect_box.h | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/redirect.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 9 | ||||
-rw-r--r-- | libs/ardour/insert.cc | 6 | ||||
-rw-r--r-- | libs/ardour/redirect.cc | 6 | ||||
-rw-r--r-- | libs/ardour/route.cc | 172 |
11 files changed, 304 insertions, 6 deletions
diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 2c40704e4e..9b68c996a4 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -301,6 +301,10 @@ <menuitem action='UseSoftwareMonitoring'/> <menuitem action='UseExternalMonitoring'/> </menu> + <menu action='Plugins'> + <menuitem action='DisableAllPlugins'/> + <menuitem action='ABAllPlugins'/> + </menu> <menu action='Metering'> <menu action='MeteringFallOffRate'> <menuitem action='MeterFalloffOff'/> @@ -386,6 +390,9 @@ <menuitem action='activate_all'/> <menuitem action='deactivate_all'/> <separator/> + <menuitem action='deactivate_plugins'/> + <menuitem action='a_b_plugins'/> + <separator/> <menuitem action='edit'/> </popup> diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 3b33fc18e1..6e0b1ce4f6 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -40,7 +40,8 @@ #include <pbd/pathscanner.h> #include <pbd/failed_constructor.h> #include <pbd/enumwriter.h> -#include <pbd/stacktrace.h> +#include <pbd/memento_command.h> + #include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/utils.h> #include <gtkmm2ext/click_box.h> @@ -189,6 +190,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile) session_loaded = false; last_speed_displayed = -1.0f; keybindings_path = ARDOUR::find_config_file ("ardour.bindings"); + ab_direction = true; can_save_keybindings = false; @@ -2842,3 +2844,42 @@ ARDOUR_UI::setup_profile () Profile->set_small_screen (); } } + +void +ARDOUR_UI::disable_all_plugins () +{ + if (!session) { + return; + } + + // session->begin_reversible_command (_("Disable all plugins")); + + boost::shared_ptr<Session::RouteList> routes = session->get_routes (); + + for (Session::RouteList::iterator i = routes->begin(); i != routes->end(); ++i) { + // XMLNode& before = (*i)->get_redirect_state (); + // session->add_command (new MementoCommand<Route>(**i, &before, 0)); + (*i)->disable_plugins (); + // XMLNode& after = (*i)->get_redirect_state (); + // session->add_command (new MementoCommand<Route>(**i, 0, &after)); + + } + + // session->commit_reversible_command (); +} + +void +ARDOUR_UI::ab_all_plugins () +{ + if (!session) { + return; + } + + boost::shared_ptr<Session::RouteList> routes = session->get_routes (); + + for (Session::RouteList::iterator i = routes->begin(); i != routes->end(); ++i) { + (*i)->ab_plugins (ab_direction); + } + + ab_direction = !ab_direction; +} diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 920cb97f44..8979417f88 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -716,6 +716,10 @@ class ARDOUR_UI : public Gtkmm2ext::UI void no_memory_warning (); void check_memory_locking (); + + bool ab_direction; + void disable_all_plugins (); + void ab_all_plugins (); }; #endif /* __ardour_gui_h__ */ diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index d4a7a183e4..f571b5bb9f 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -90,6 +90,7 @@ ARDOUR_UI::install_actions () ActionManager::register_action (main_actions, X_("AudioFileFormatHeader"), _("Header")); ActionManager::register_action (main_actions, X_("AudioFileFormatData"), _("Data")); ActionManager::register_action (main_actions, X_("ControlSurfaces"), _("Control Surfaces")); + ActionManager::register_action (main_actions, X_("Plugins"), _("Plugins")); ActionManager::register_action (main_actions, X_("Metering"), _("Metering")); ActionManager::register_action (main_actions, X_("MeteringFallOffRate"), _("Fall off rate")); ActionManager::register_action (main_actions, X_("MeteringHoldTime"), _("Hold Time")); @@ -423,6 +424,11 @@ ARDOUR_UI::install_actions () act = ActionManager::register_toggle_action (option_actions, X_("ShowSoloMutes"), _("Show solo muting"), mem_fun (*this, &ARDOUR_UI::toggle_ShowSoloMutes)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (option_actions, X_("DisableAllPlugins"), _("Disable All Plugins"), mem_fun (*this, &ARDOUR_UI::disable_all_plugins)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (option_actions, X_("ABAllPlugins"), _("A/B All Plugins"), mem_fun (*this, &ARDOUR_UI::ab_all_plugins)); + ActionManager::session_sensitive_actions.push_back (act); + /* !!! REMEMBER THAT RADIO ACTIONS HAVE TO BE HANDLED WITH MORE FINESSE THAN SIMPLE TOGGLES !!! */ RadioAction::Group meter_falloff_group; diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 2b908ebaa2..96e99e4667 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -105,6 +105,7 @@ RedirectBox::RedirectBox (Placement pcmnt, Session& sess, boost::shared_ptr<Rout redirect_drag_in_progress = false; no_redirect_redisplay = false; ignore_delete = false; + ab_direction = true; model = ListStore::create(columns); @@ -628,7 +629,11 @@ RedirectBox::build_redirect_tooltip (EventBox& box, string start) for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { Gtk::TreeModel::Row row = *iter; tip += '\n'; - tip += row[columns.text]; + + /* don't use the column text, since it may be narrowed */ + + boost::shared_ptr<Redirect> r = row[columns.redirect]; + tip += r->name(); } ARDOUR_UI::instance()->tooltips().set_tip (box, tip); } @@ -996,6 +1001,23 @@ RedirectBox::all_redirects_active (bool state) } void +RedirectBox::all_plugins_active (bool state) +{ + if (state) { + // XXX not implemented + } else { + _route->disable_plugins (_placement); + } +} + +void +RedirectBox::ab_plugins () +{ + _route->ab_plugins (ab_direction); + ab_direction = !ab_direction; +} + +void RedirectBox::clear_redirects () { string prompt; @@ -1223,6 +1245,9 @@ RedirectBox::register_actions () ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"), sigc::ptr_fun (RedirectBox::rb_activate_all)); ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"), sigc::ptr_fun (RedirectBox::rb_deactivate_all)); + ActionManager::register_action (popup_act_grp, X_("a_b_plugins"), _("A/B plugins"), sigc::ptr_fun (RedirectBox::rb_ab_plugins)); + ActionManager::register_action (popup_act_grp, X_("deactivate_plugins"), _("Deactivate plugins"), sigc::ptr_fun (RedirectBox::rb_deactivate_plugins)); + /* show editors */ act = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit"), sigc::ptr_fun (RedirectBox::rb_edit)); ActionManager::plugin_selection_sensitive_actions.push_back(act); @@ -1376,6 +1401,27 @@ RedirectBox::rb_deactivate_all () } void +RedirectBox::rb_deactivate_plugins () +{ + if (_current_redirect_box == 0) { + return; + } + _current_redirect_box->all_plugins_active (false); +} + + +void +RedirectBox::rb_ab_plugins () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->ab_plugins (); +} + + +void RedirectBox::rb_edit () { if (_current_redirect_box == 0) { diff --git a/gtk2_ardour/redirect_box.h b/gtk2_ardour/redirect_box.h index cb126dc13f..88fbd5924d 100644 --- a/gtk2_ardour/redirect_box.h +++ b/gtk2_ardour/redirect_box.h @@ -91,6 +91,7 @@ class RedirectBox : public Gtk::HBox boost::shared_ptr<ARDOUR::Route> _route; ARDOUR::Session & _session; bool _owner_is_mixer; + bool ab_direction; ARDOUR::Placement _placement; @@ -170,6 +171,8 @@ class RedirectBox : public Gtk::HBox void redirect_drag_begin (GdkDragContext*); void redirect_drag_end (GdkDragContext*); void all_redirects_active(bool state); + void all_plugins_active(bool state); + void ab_plugins (); void cut_redirects (); void copy_redirects (); @@ -217,6 +220,8 @@ class RedirectBox : public Gtk::HBox static void rb_activate_all (); static void rb_deactivate_all (); static void rb_edit (); + static void rb_ab_plugins (); + static void rb_deactivate_plugins (); void route_name_changed (void* src, PluginUIWindow* plugin_ui, boost::weak_ptr<ARDOUR::PluginInsert> pi); std::string generate_redirect_title (boost::shared_ptr<ARDOUR::PluginInsert> pi); diff --git a/libs/ardour/ardour/redirect.h b/libs/ardour/ardour/redirect.h index fac2241f14..fbbb295a24 100644 --- a/libs/ardour/ardour/redirect.h +++ b/libs/ardour/ardour/redirect.h @@ -108,6 +108,9 @@ class Redirect : public IO bool find_next_event (nframes_t, nframes_t, ControlEvent&) const; virtual void transport_stopped (nframes_t frame) {}; + + bool get_next_ab_is_active () const { return _next_ab_is_active; } + void set_next_ab_is_active (bool yn); protected: /* children may use this stuff as they see fit */ @@ -127,6 +130,7 @@ class Redirect : public IO private: bool _active; + bool _next_ab_is_active; Placement _placement; uint32_t _sort_key; void* _gui; /* generic, we don't know or care what this is */ diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 6247d79a27..af27a99b9d 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -168,7 +168,11 @@ class Route : public IO int remove_redirect (boost::shared_ptr<Redirect>, void *src, uint32_t* err_streams = 0); int copy_redirects (const Route&, Placement, uint32_t* err_streams = 0); int sort_redirects (uint32_t* err_streams = 0); - + void disable_redirects (Placement); + void disable_redirects (); + void disable_plugins (Placement); + void disable_plugins (); + void ab_plugins (bool forward); void clear_redirects (Placement, void *src); void all_redirects_flip(); void all_redirects_active (Placement, bool state); @@ -202,6 +206,9 @@ class Route : public IO int set_state(const XMLNode& node); virtual XMLNode& get_template(); + XMLNode& get_redirect_state (); + int set_redirect_state (const XMLNode&); + sigc::signal<void,void*> SelectedChanged; int set_control_outs (const vector<std::string>& ports); diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index 66cf6b1d4c..f08661b06a 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -613,13 +613,13 @@ PluginInsert::state (bool full) /* add port automation state */ XMLNode *autonode = new XMLNode(port_automation_node_name); set<uint32_t> automatable = _plugins[0]->automatable(); - + for (set<uint32_t>::iterator x = automatable.begin(); x != automatable.end(); ++x) { - + XMLNode* child = new XMLNode("port"); snprintf(buf, sizeof(buf), "%" PRIu32, *x); child->add_property("number", string(buf)); - + child->add_child_nocopy (automation_list (*x).state (full)); autonode->add_child_nocopy (*child); } diff --git a/libs/ardour/redirect.cc b/libs/ardour/redirect.cc index ba895f6447..bdcc718710 100644 --- a/libs/ardour/redirect.cc +++ b/libs/ardour/redirect.cc @@ -51,6 +51,7 @@ Redirect::Redirect (Session& s, const string& name, Placement p, { _placement = p; _active = false; + _next_ab_is_active = false; _sort_key = 0; _gui = 0; _extra_xml = 0; @@ -477,3 +478,8 @@ Redirect::set_active (bool yn, void* src) _session.set_dirty (); } +void +Redirect::set_next_ab_is_active (bool yn) +{ + _next_ab_is_active = yn; +} diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 30de550c2f..81fcdb4cec 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -883,6 +883,110 @@ Route::add_redirects (const RedirectList& others, void *src, uint32_t* err_strea return 0; } +/** Turn off all redirects with a given placement + * @param p Placement of redirects to disable + */ + +void +Route::disable_redirects (Placement p) +{ + Glib::RWLock::ReaderLock lm (redirect_lock); + + for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { + if ((*i)->placement() == p) { + (*i)->set_active (false, this); + } + } +} + +/** Turn off all redirects + */ + +void +Route::disable_redirects () +{ + Glib::RWLock::ReaderLock lm (redirect_lock); + + for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { + (*i)->set_active (false, this); + } +} + +/** Turn off all redirects with a given placement + * @param p Placement of redirects to disable + */ + +void +Route::disable_plugins (Placement p) +{ + Glib::RWLock::ReaderLock lm (redirect_lock); + + for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { + if (boost::dynamic_pointer_cast<PluginInsert> (*i) && (*i)->placement() == p) { + (*i)->set_active (false, this); + } + } +} + +/** Turn off all plugins + */ + +void +Route::disable_plugins () +{ + Glib::RWLock::ReaderLock lm (redirect_lock); + + for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { + if (boost::dynamic_pointer_cast<PluginInsert> (*i)) { + (*i)->set_active (false, this); + } + } +} + + +void +Route::ab_plugins (bool forward) +{ + Glib::RWLock::ReaderLock lm (redirect_lock); + + if (forward) { + + /* forward = turn off all active redirects, and mark them so that the next time + we go the other way, we will revert them + */ + + for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { + if (!boost::dynamic_pointer_cast<PluginInsert> (*i)) { + continue; + } + + if ((*i)->active()) { + (*i)->set_active (false, this); + (*i)->set_next_ab_is_active (true); + } else { + (*i)->set_next_ab_is_active (false); + } + } + + } else { + + /* backward = if the redirect was marked to go active on the next ab, do so */ + + for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { + + if (!boost::dynamic_pointer_cast<PluginInsert> (*i)) { + continue; + } + + if ((*i)->get_next_ab_is_active()) { + (*i)->set_active (true, this); + } else { + (*i)->set_active (false, this); + } + } + } +} + /** Remove redirects with a given placement. * @param p Placement of redirects to remove. */ @@ -1424,6 +1528,74 @@ Route::state(bool full_state) return *node; } +XMLNode& +Route::get_redirect_state () +{ + XMLNode* root = new XMLNode (X_("redirects")); + for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { + root->add_child_nocopy ((*i)->state (true)); + } + + return *root; +} + +int +Route::set_redirect_state (const XMLNode& root) +{ + if (root.name() != X_("redirects")) { + return -1; + } + + XMLNodeList nlist; + XMLNodeList nnlist; + XMLNodeConstIterator iter; + XMLNodeConstIterator niter; + Glib::RWLock::ReaderLock lm (redirect_lock); + + nlist = root.children(); + + for (iter = nlist.begin(); iter != nlist.end(); ++iter){ + + /* iter now points to a Redirect state node */ + + nnlist = (*iter)->children (); + + for (niter = nnlist.begin(); niter != nnlist.end(); ++niter) { + + /* find the IO child node, since it contains the ID we need */ + + /* XXX OOP encapsulation violation, ugh */ + + if ((*niter)->name() == IO::state_node_name) { + + XMLProperty* prop = (*niter)->property (X_("id")); + + if (!prop) { + warning << _("Redirect node has no ID, ignored") << endmsg; + break; + } + + ID id = prop->value (); + + /* now look for a redirect with that ID */ + + for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { + if ((*i)->id() == id) { + (*i)->set_state (**iter); + break; + } + } + + break; + + } + } + + } + + return 0; +} + void Route::set_deferred_state () { |