mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 15:15:41 +01:00
Reset PanControllable StreamPanners when they change.
git-svn-id: svn://localhost/ardour2/branches/3.0@8243 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
19ae4ed640
commit
e8fede43ee
3 changed files with 20 additions and 11 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue