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

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