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
This commit is contained in:
Paul Davis 2007-05-14 14:13:59 +00:00
parent 20cdab6416
commit bac4734a13
11 changed files with 304 additions and 6 deletions

View file

@ -300,6 +300,10 @@
<menuitem action='UseHardwareMonitoring'/>
<menuitem action='UseSoftwareMonitoring'/>
<menuitem action='UseExternalMonitoring'/>
</menu>
<menu action='Plugins'>
<menuitem action='DisableAllPlugins'/>
<menuitem action='ABAllPlugins'/>
</menu>
<menu action='Metering'>
<menu action='MeteringFallOffRate'>
@ -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>

View file

@ -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;
}

View file

@ -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__ */

View file

@ -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;

View file

@ -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);
}
@ -995,6 +1000,23 @@ RedirectBox::all_redirects_active (bool state)
_route->all_redirects_active (_placement, 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 ()
{
@ -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);
@ -1375,6 +1400,27 @@ RedirectBox::rb_deactivate_all ()
_current_redirect_box->all_redirects_active (false);
}
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 ()
{

View file

@ -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);

View file

@ -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 */

View file

@ -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);

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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 ()
{