Fix Mackie control Gain while in flip mode (vpot control of gain)
authorLen Ovens <len@ovenwerks.net>
Wed, 9 Dec 2015 17:21:36 +0000 (09:21 -0800)
committerLen Ovens <len@ovenwerks.net>
Wed, 9 Dec 2015 17:21:36 +0000 (09:21 -0800)
libs/ardour/ardour/route.h
libs/ardour/route.cc

index af2a7f78a0c10835c1b669b6b98d151c78e84199..2bafcf3b637363f7459a03f59a896b9f2f767f1c 100644 (file)
@@ -427,8 +427,7 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
        public:
                GroupGainControllable (std::string name, boost::shared_ptr<Route>);
                void set_value (double);
-               // We get the value from the amp where we get the changed signal from
-               //double get_value () const;
+               double get_value () const;
        private:
                boost::weak_ptr<Route> _route;
        };
index 53630d4e9ccb83cdc3fa2589de4fb5ebe11738cb..6ee55fc26e1fbeff72088b7cb439130b2f57fd3d 100644 (file)
@@ -136,17 +136,14 @@ Route::init ()
        _solo_control.reset (new SoloControllable (X_("solo"), shared_from_this ()));
        _mute_control.reset (new MuteControllable (X_("mute"), shared_from_this ()));
        _phase_control.reset (new PhaseControllable (X_("phase"), shared_from_this ()));
-       _group_gain_control.reset (new GroupGainControllable (X_("groupgain"), shared_from_this ()));
 
        _solo_control->set_flags (Controllable::Flag (_solo_control->flags() | Controllable::Toggle));
        _mute_control->set_flags (Controllable::Flag (_mute_control->flags() | Controllable::Toggle));
        _phase_control->set_flags (Controllable::Flag (_phase_control->flags() | Controllable::Toggle));
-       _group_gain_control->set_flags (Controllable::Flag (_group_gain_control->flags() | Controllable::GainLike));
 
        add_control (_solo_control);
        add_control (_mute_control);
        add_control (_phase_control);
-       add_control (_group_gain_control);
 
        /* panning */
 
@@ -177,6 +174,11 @@ Route::init ()
        _amp.reset (new Amp (_session));
        add_processor (_amp, PostFader);
 
+       // amp should exist before amp controls
+       _group_gain_control.reset (new GroupGainControllable (X_("groupgain"), shared_from_this ()));
+       _group_gain_control->set_flags (Controllable::Flag (_group_gain_control->flags() | Controllable::GainLike));
+       add_control (_group_gain_control);
+
        /* and input trim */
        _trim.reset (new Amp (_session, "trim"));
        _trim->set_display_to_user (false);
@@ -3998,6 +4000,13 @@ Route::GroupGainControllable::set_value (double val)
        r->set_gain ((gain_t)normalized_position, this);
 }
 
+double
+Route::GroupGainControllable::get_value () const
+{
+       boost::shared_ptr<Route> r = _route.lock ();
+       return 2.0 * r->gain_control()->internal_to_interface (r->gain_control()->get_value ());
+}
+
 Route::PhaseControllable::PhaseControllable (std::string name, boost::shared_ptr<Route> r)
        : AutomationControl (r->session(),
                                                Evoral::Parameter (PhaseAutomation),