diff options
author | Carl Hetherington <carl@carlh.net> | 2010-12-11 00:24:17 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-12-11 00:24:17 +0000 |
commit | e8fede43eeda1fba263f79ac5647bc7abf955733 (patch) | |
tree | c5c066483556177eeecb90736997950cf586579b /libs/ardour | |
parent | 19ae4ed6403075647118180c241fd68cbbdc24a6 (diff) |
Reset PanControllable StreamPanners when they change.
git-svn-id: svn://localhost/ardour2/branches/3.0@8243 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/panner.h | 4 | ||||
-rw-r--r-- | libs/ardour/automatable.cc | 2 | ||||
-rw-r--r-- | libs/ardour/panner.cc | 25 |
3 files changed, 20 insertions, 11 deletions
diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 4550aab5a5..9d6a248de0 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -88,14 +88,14 @@ class StreamPanner : public PBD::Stateful virtual int load (std::istream&, std::string path, uint32_t&) = 0; struct PanControllable : public AutomationControl { - PanControllable (Session& s, std::string name, StreamPanner& p, Evoral::Parameter param) + PanControllable (Session& s, std::string name, StreamPanner* p, Evoral::Parameter param) : AutomationControl (s, param, boost::shared_ptr<AutomationList>(new AutomationList(param)), name) , streampanner (p) { assert (param.type() == PanAutomation); } AutomationList* alist() { return (AutomationList*)_list.get(); } - StreamPanner& streampanner; + StreamPanner* streampanner; void set_value (double); double get_value (void) const; diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 248bb96b52..03e5ad97c3 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -459,7 +459,7 @@ Automatable::control_factory(const Evoral::Parameter& param) Panner* panner = dynamic_cast<Panner*>(this); if (panner) { StreamPanner& sp (panner->streampanner (param.channel())); - control = new StreamPanner::PanControllable (_a_session, X_("direction"), sp, param); + control = new StreamPanner::PanControllable (_a_session, X_("direction"), &sp, param); } else { warning << "PanAutomation for non-Panner" << endl; } diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index 0727f5454a..c14c20a354 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -75,7 +75,7 @@ static double direct_control_to_stereo_pan (double fract) StreamPanner::StreamPanner (Panner& p, Evoral::Parameter param) : parent (p) - , _control (new PanControllable (parent.session(), _("direction"), *this, param)) + , _control (new PanControllable (parent.session(), _("direction"), this, param)) { assert (param.type() != NullAutomation); @@ -112,7 +112,7 @@ StreamPanner::PanControllable::lower () const void StreamPanner::PanControllable::set_value (double val) { - Panner& p (streampanner.get_parent()); + Panner& p (streampanner->get_parent()); switch (parameter().id()) { case 100: /* position */ @@ -131,7 +131,7 @@ StreamPanner::PanControllable::set_value (double val) break; default: - streampanner.set_position (AngularVector (direct_control_to_stereo_pan (val), 0.0)); + streampanner->set_position (AngularVector (direct_control_to_stereo_pan (val), 0.0)); AutomationControl::set_value(val); break; } @@ -1505,19 +1505,28 @@ Panner::setup_meta_controls () boost::shared_ptr<AutomationControl> dc = automation_control (lr_param); boost::shared_ptr<AutomationControl> wc = automation_control (width_param); - if (!dc) { - dc.reset (new StreamPanner::PanControllable (_session, _("lr"), *_streampanners.front(), lr_param)); + if (dc) { + /* reset parent StreamPanner as the current one may have been deleted */ + boost::shared_ptr<StreamPanner::PanControllable> p = boost::dynamic_pointer_cast<StreamPanner::PanControllable> (dc); + assert (p); + p->streampanner = _streampanners.front (); + } else { + dc.reset (new StreamPanner::PanControllable (_session, _("lr"), _streampanners.front(), lr_param)); add_control (dc); } - if (!wc) { - wc.reset (new StreamPanner::PanControllable (_session, _("width"), *_streampanners.front(), width_param)); + if (wc) { + /* reset parent as above */ + boost::shared_ptr<StreamPanner::PanControllable> p = boost::dynamic_pointer_cast<StreamPanner::PanControllable> (wc); + assert (p); + p->streampanner = _streampanners.front (); + } else { + wc.reset (new StreamPanner::PanControllable (_session, _("width"), _streampanners.front(), width_param)); add_control (wc); } dc->set_value (0.5); wc->set_value (1.0); // full width - } string |