summaryrefslogtreecommitdiff
path: root/libs/ardour/track.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-12-07 15:48:38 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-12-07 15:48:38 +0000
commit8ca9061b308238ba80d82b6960e79fa1ea5cda92 (patch)
tree299b123786e43f41bbfa6659b7efbd050dafab06 /libs/ardour/track.cc
parenteacba74649e961508fb85eddb1e8dd51d8c61be5 (diff)
fix issues with rec-enabling being done in RT context by splitting it into two parts, an RT-safe and RT-unsafe part. along the way, remove "do not record plugins" option which is just so 1999 and creates problems for various (all?) plugin APIs
git-svn-id: svn://localhost/ardour2/branches/3.0@13613 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/track.cc')
-rw-r--r--libs/ardour/track.cc116
1 files changed, 34 insertions, 82 deletions
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 24f486fa61..22edb52dcb 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -46,8 +46,6 @@ Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, Data
{
_freeze_record.state = NoFreeze;
_declickable = true;
-
- Config->ParameterChanged.connect_same_thread (*this, boost::bind (&Track::parameter_changed, this, _1));
}
Track::~Track ()
@@ -100,19 +98,6 @@ Track::state (bool full)
root.add_property (X_("saved-meter-point"), enum_2_string (_saved_meter_point));
root.add_child_nocopy (_rec_enable_control->get_state());
root.add_child_nocopy (_diskstream->get_state ());
-
- if (!_deactivated_processors.empty ()) {
- XMLNode* node = new XMLNode (X_("DeactivatedProcessors"));
- for (list<boost::weak_ptr<Processor> >::iterator i = _deactivated_processors.begin(); i != _deactivated_processors.end(); ++i) {
- boost::shared_ptr<Processor> p = i->lock ();
- if (p) {
- XMLNode* c = new XMLNode (X_("Processor"));
- c->add_property (X_("id"), p->id().to_s());
- node->add_child_nocopy (*c);
- }
- }
- root.add_child_nocopy (*node);
- }
return root;
}
@@ -152,18 +137,6 @@ Track::set_state (const XMLNode& node, int version)
_rec_enable_control->set_state (*child, version);
}
}
-
- if (child->name() == X_("DeactivatedProcessors")) {
- XMLNodeList dp = child->children ();
- for (XMLNodeConstIterator i = dp.begin(); i != dp.end(); ++i) {
- assert ((*i)->name() == X_("Processor"));
- XMLProperty* prop = (*i)->property (X_("id"));
- boost::shared_ptr<Processor> p = processor_by_id (PBD::ID (prop->value ()));
- if (p) {
- _deactivated_processors.push_back (p);
- }
- }
- }
}
const XMLProperty* prop;
@@ -250,35 +223,8 @@ Track::can_record()
return will_record;
}
-/* Turn off visible processors (except Fader), keeping track of the old states */
void
-Track::deactivate_visible_processors ()
-{
- _deactivated_processors.clear ();
- Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
-
- for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
- if ((*i)->active() && (*i)->display_to_user() && boost::dynamic_pointer_cast<Amp> (*i) == 0) {
- (*i)->deactivate ();
- _deactivated_processors.push_back (*i);
- }
- }
-}
-
-/* Turn deactivated processors back on again */
-void
-Track::activate_deactivated_processors ()
-{
- for (list<boost::weak_ptr<Processor> >::iterator i = _deactivated_processors.begin(); i != _deactivated_processors.end(); ++i) {
- boost::shared_ptr<Processor> p = i->lock ();
- if (p) {
- p->activate ();
- }
- }
-}
-
-void
-Track::set_record_enabled (bool yn, void *src)
+Track::prep_record_enabled (bool yn, void *src)
{
if (!_session.writable()) {
return;
@@ -289,7 +235,7 @@ Track::set_record_enabled (bool yn, void *src)
}
if (_route_group && src != _route_group && _route_group->is_active() && _route_group->is_recenable()) {
- _route_group->apply (&Track::set_record_enabled, yn, _route_group);
+ _route_group->apply (&Track::prep_record_enabled, yn, _route_group);
return;
}
@@ -298,28 +244,50 @@ Track::set_record_enabled (bool yn, void *src)
_saved_meter_point = _meter_point;
}
- if (Config->get_do_not_record_plugins ()) {
+ bool will_follow;
+
+ if (yn) {
+ will_follow = _diskstream->prep_record_enable ();
+ } else {
+ will_follow = _diskstream->prep_record_disable ();
+ }
+
+ if (will_follow) {
if (yn) {
- deactivate_visible_processors ();
+ if (_meter_point != MeterCustom) {
+ set_meter_point (MeterInput);
+ }
} else {
- activate_deactivated_processors ();
+ set_meter_point (_saved_meter_point);
}
}
+}
+
+void
+Track::set_record_enabled (bool yn, void *src)
+{
+ if (!_session.writable()) {
+ return;
+ }
- _diskstream->set_record_enabled (yn);
+ if (_freeze_record.state == Frozen) {
+ return;
+ }
- if (_diskstream->record_enabled()) {
- if (_meter_point != MeterCustom) {
- set_meter_point (MeterInput);
- }
+ if (_route_group && src != _route_group && _route_group->is_active() && _route_group->is_recenable()) {
+ _route_group->apply (&Track::set_record_enabled, yn, _route_group);
+ return;
+ }
+
+ if (yn) {
+ _diskstream->engage_record_enable();
} else {
- set_meter_point (_saved_meter_point);
+ _diskstream->disengage_record_enable();
}
_rec_enable_control->Changed ();
}
-
bool
Track::set_name (const string& str)
{
@@ -950,22 +918,6 @@ Track::set_monitoring (MonitorChoice mc)
}
}
-void
-Track::parameter_changed (string p)
-{
- if (p != "do-not-record-plugins") {
- return;
- }
-
- if (record_enabled ()) {
- if (Config->get_do_not_record_plugins ()) {
- deactivate_visible_processors ();
- } else {
- activate_deactivated_processors ();
- }
- }
-}
-
MeterState
Track::metering_state () const
{