Various optimisations to speed up rec-enable.

git-svn-id: svn://localhost/ardour2/branches/3.0@6227 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-11-30 23:16:28 +00:00
parent 4497db3f1a
commit fddc11f556
18 changed files with 107 additions and 25 deletions

View File

@ -115,7 +115,7 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
/* map current state of the route */
processors_changed ();
processors_changed (RouteProcessorChange ());
reset_processor_automation_curves ();
ensure_pan_views (false);
update_control_names ();

View File

@ -132,7 +132,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess,
/* map current state of the route */
processors_changed ();
processors_changed (RouteProcessorChange ());
ensure_xml_node ();

View File

@ -1609,6 +1609,7 @@ MixerStrip::engine_running ()
{
}
/** Called when the metering point has changed */
void
MixerStrip::meter_changed (void *src)
{
@ -1635,7 +1636,6 @@ MixerStrip::meter_changed (void *src)
gpm.setup_meters ();
// reset peak when meter point changes
gpm.reset_peak_display();
set_width_enum (_width, this);
}
void

View File

@ -142,11 +142,22 @@ PortMatrix::reconnect_to_routes ()
boost::shared_ptr<RouteList> routes = _session.get_routes ();
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
_route_connections.push_back (
(*i)->processors_changed.connect (mem_fun (*this, &PortMatrix::setup_global_ports))
(*i)->processors_changed.connect (mem_fun (*this, &PortMatrix::route_processors_changed))
);
}
}
void
PortMatrix::route_processors_changed (RouteProcessorChange c)
{
if (c.type == RouteProcessorChange::MeterPointChange) {
/* this change has no impact on the port matrix */
return;
}
setup_global_ports ();
}
/** A route has been added to or removed from the session */
void
PortMatrix::routes_changed ()

View File

@ -29,6 +29,7 @@
#include <gtkmm/notebook.h>
#include <boost/shared_ptr.hpp>
#include "ardour/bundle.h"
#include "ardour/types.h"
#include "port_group.h"
#include "port_matrix_types.h"
#include "i18n.h"
@ -178,6 +179,7 @@ private:
void remove_notebook_pages (Gtk::Notebook &);
void v_page_selected (GtkNotebookPage *, guint);
void h_page_selected (GtkNotebookPage *, guint);
void route_processors_changed (ARDOUR::RouteProcessorChange);
Gtk::Window* _parent;

View File

@ -318,8 +318,7 @@ ProcessorBox::set_route (boost::shared_ptr<Route> r)
no_processor_redisplay = false;
_route = r;
connections.push_back (_route->processors_changed.connect (
mem_fun(*this, &ProcessorBox::redisplay_processors)));
connections.push_back (_route->processors_changed.connect (mem_fun (*this, &ProcessorBox::route_processors_changed)));
connections.push_back (_route->GoingAway.connect (
mem_fun (*this, &ProcessorBox::route_going_away)));
connections.push_back (_route->NameChanged.connect (
@ -924,6 +923,17 @@ ProcessorBox::choose_aux (boost::weak_ptr<Route> wr)
_session.add_internal_sends (target, PreFader, rlist);
}
void
ProcessorBox::route_processors_changed (RouteProcessorChange c)
{
if (c.type == RouteProcessorChange::MeterPointChange && c.meter_visibly_changed == false) {
/* the meter has moved, but it was and still is invisible to the user, so nothing to do */
return;
}
redisplay_processors ();
}
void
ProcessorBox::redisplay_processors ()
{

View File

@ -200,6 +200,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject
void redisplay_processors ();
void add_processor_to_display (boost::weak_ptr<ARDOUR::Processor>);
void reordered ();
void route_processors_changed (ARDOUR::RouteProcessorChange);
void remove_processor_gui (boost::shared_ptr<ARDOUR::Processor>);

View File

@ -480,9 +480,9 @@ RouteParams_UI::route_selected()
}
void
RouteParams_UI::processors_changed ()
RouteParams_UI::processors_changed (RouteProcessorChange c)
{
ENSURE_GUI_THREAD(mem_fun(*this, &RouteParams_UI::processors_changed));
ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteParams_UI::processors_changed), c));
cleanup_view();
_processor.reset ((Processor*) 0);

View File

@ -174,7 +174,7 @@ class RouteParams_UI : public ArdourDialog
void cleanup_latency_frame ();
void setup_latency_frame ();
void processors_changed ();
void processors_changed (ARDOUR::RouteProcessorChange);
void setup_processor_boxes();
void cleanup_processor_boxes();

View File

@ -55,6 +55,7 @@
#include "ardour/route_group.h"
#include "ardour/session.h"
#include "ardour/session_playlist.h"
#include "ardour/debug.h"
#include "ardour/utils.h"
#include "evoral/Parameter.hpp"
@ -2118,8 +2119,13 @@ RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::ProcessorAuto
}
void
RouteTimeAxisView::processors_changed ()
RouteTimeAxisView::processors_changed (RouteProcessorChange c)
{
if (c.type == RouteProcessorChange::MeterPointChange) {
/* nothing to do if only the meter point has changed */
return;
}
using namespace Menu_Helpers;
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {

View File

@ -186,7 +186,7 @@ protected:
gint edit_click (GdkEventButton *);
void processors_changed ();
void processors_changed (ARDOUR::RouteProcessorChange);
void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
void remove_processor_automation_node (ProcessorAutomationNode* pan);

View File

@ -130,7 +130,7 @@ class RouteUI : public virtual AxisView
void solo_changed_so_update_mute ();
void mute_changed(void*);
void listen_changed(void*);
virtual void processors_changed () {}
virtual void processors_changed (ARDOUR::RouteProcessorChange) {}
void route_rec_enable_changed();
void session_rec_enable_changed();

View File

@ -240,10 +240,13 @@ class Route : public SessionObject, public AutomatableControls
sigc::signal<void,void*> comment_changed;
sigc::signal<void,void*> mute_changed;
sigc::signal<void> mute_points_changed;
sigc::signal<void> processors_changed;
/** the processors have changed; the parameter indicates what changed */
sigc::signal<void, RouteProcessorChange> processors_changed;
sigc::signal<void,void*> record_enable_changed;
sigc::signal<void,void*> route_group_changed;
sigc::signal<void,void*> meter_change;
/** the metering point has changed */
sigc::signal<void,void*> meter_change;
sigc::signal<void> signal_latency_changed;
sigc::signal<void> initial_delay_changed;

View File

@ -1446,6 +1446,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
void route_processors_changed (RouteProcessorChange);
/* mixer stuff */
bool solo_update_disabled;

View File

@ -428,6 +428,36 @@ namespace ARDOUR {
int64_t space;
};
/** A struct used to describe changes to processors in a route.
* This is useful because objects that respond to a change in processors
* can optimise what work they do based on details of what has changed.
*/
struct RouteProcessorChange {
enum Type {
GeneralChange = 0x0,
MeterPointChange = 0x1
};
RouteProcessorChange () {
type = GeneralChange;
}
RouteProcessorChange (Type t) {
type = t;
meter_visibly_changed = true;
}
RouteProcessorChange (Type t, bool m) {
type = t;
meter_visibly_changed = m;
}
/** type of change; "GeneralChange" means anything could have changed */
Type type;
/** true if, when a MeterPointChange has occurred, the change is visible to the user */
bool meter_visibly_changed;
};
} // namespace ARDOUR

View File

@ -772,7 +772,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite
_output->set_user_latency (0);
}
processors_changed (); /* EMIT SIGNAL */
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
return 0;
}
@ -1031,7 +1031,7 @@ Route::add_processors (const ProcessorList& others, ProcessorList::iterator iter
_output->set_user_latency (0);
}
processors_changed (); /* EMIT SIGNAL */
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
return 0;
}
@ -1231,7 +1231,7 @@ Route::clear_processors (Placement p)
processor_max_streams.reset();
_have_internal_generator = false;
processors_changed (); /* EMIT SIGNAL */
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
if (!already_deleting) {
_session.clear_deletion_in_progress();
@ -1322,7 +1322,7 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
}
processor->drop_references ();
processors_changed (); /* EMIT SIGNAL */
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
return 0;
}
@ -1414,7 +1414,7 @@ Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams*
(*i)->drop_references ();
}
processors_changed (); /* EMIT SIGNAL */
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
return 0;
}
@ -1654,7 +1654,7 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err
}
}
processors_changed (); /* EMIT SIGNAL */
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
return 0;
}
@ -2243,7 +2243,7 @@ Route::set_processor_state (const XMLNode& node)
the XML state represents a working signal route.
*/
processors_changed ();
processors_changed (RouteProcessorChange ());
}
void
@ -2683,6 +2683,8 @@ Route::set_meter_point (MeterPoint p, void *src)
return;
}
bool meter_was_visible_to_user = _meter->display_to_user ();
{
Glib::RWLock::WriterLock lm (_processor_lock);
ProcessorList as_it_was (_processors);
@ -2723,10 +2725,15 @@ Route::set_meter_point (MeterPoint p, void *src)
}
}
_meter_point = p;
meter_change (src); /* EMIT SIGNAL */
processors_changed (); /* EMIT SIGNAL */
/* the meter has visibly changed if it is not visible to the user, or if it was and now isn't */
bool const meter_visibly_changed = _meter->display_to_user() || meter_was_visible_to_user;
processors_changed (RouteProcessorChange (RouteProcessorChange::MeterPointChange, meter_visibly_changed)); /* EMIT SIGNAL */
_session.set_dirty ();
}
@ -2767,7 +2774,7 @@ Route::put_control_outs_at (Placement p)
}
}
processors_changed (); /* EMIT SIGNAL */
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
_session.set_dirty ();
}

View File

@ -2174,7 +2174,7 @@ Session::add_routes (RouteList& new_routes, bool save)
(*x)->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), wpr));
(*x)->mute_changed.connect (mem_fun (*this, &Session::route_mute_changed));
(*x)->output()->changed.connect (mem_fun (*this, &Session::set_worst_io_latencies_x));
(*x)->processors_changed.connect (bind (mem_fun (*this, &Session::update_latency_compensation), false, false));
(*x)->processors_changed.connect (mem_fun (*this, &Session::route_processors_changed));
(*x)->route_group_changed.connect (hide (mem_fun (*this, &Session::route_group_changed)));
if ((*x)->is_master()) {

View File

@ -1420,6 +1420,16 @@ Session::xrun_recovery ()
}
}
void
Session::route_processors_changed (RouteProcessorChange c)
{
if (c.type == RouteProcessorChange::MeterPointChange) {
return;
}
update_latency_compensation (false, false);
}
void
Session::update_latency_compensation (bool with_stop, bool abort)
{