Fix 'sticky' sliders when MIDI control feedback is enabled.
authorDavid Robillard <d@drobilla.net>
Wed, 18 Feb 2009 23:54:41 +0000 (23:54 +0000)
committerDavid Robillard <d@drobilla.net>
Wed, 18 Feb 2009 23:54:41 +0000 (23:54 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@4628 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/gain_meter.cc
libs/ardour/ardour/automation_control.h
libs/pbd/controllable.cc
libs/pbd/pbd/controllable.h
libs/surfaces/generic_midi/midicontrollable.cc

index 429331178ce6eeba378aacf67bb4b44005b5a875..85562bac0e8cae659e941d196772e206cb5530e6 100644 (file)
@@ -569,14 +569,14 @@ GainMeterBase::meter_point_clicked ()
 gint
 GainMeterBase::start_gain_touch (GdkEventButton* ev)
 {
-       _io->gain_control()->alist()->start_touch ();
+       _io->gain_control()->start_touch ();
        return FALSE;
 }
 
 gint
 GainMeterBase::end_gain_touch (GdkEventButton* ev)
 {
-       _io->gain_control()->alist()->stop_touch ();
+       _io->gain_control()->stop_touch ();
        return FALSE;
 }
 
index d3a220efbc694752c3e82999e15f9f52bd1a9339..e4b024a290a953b77c386cb9776df3de142d7bd9 100644 (file)
@@ -65,10 +65,12 @@ public:
        }
        
        inline void start_touch() {
+               set_touching (true);
                return ((ARDOUR::AutomationList*)_list.get())->start_touch();
        }
        
        inline void stop_touch() {
+               set_touching (false);
                return ((ARDOUR::AutomationList*)_list.get())->stop_touch();
        }
 
index c79e0cb3d8090e220e0d21c2a388a2c085a3e311..4788965c974e571102890044733978b0cf07b8e5 100644 (file)
@@ -36,6 +36,7 @@ Controllable::Controllables Controllable::registry;
 
 Controllable::Controllable (std::string name)
        : _name (name)
+       , _touching (false)
 {
        if (registry_lock == 0) {
                registry_lock = new Glib::Mutex;
index 9fa374ebc66c842b126c04d28b3c55a5467ba3ae..6d3746441963a3ab4e89d7bd7f9074e522a047e2 100644 (file)
@@ -54,13 +54,17 @@ class Controllable : public PBD::StatefulDestructible {
        int set_state (const XMLNode&);
        XMLNode& get_state ();
 
-       std::string name() const { return _name; }
+       std::string name()      const { return _name; }
+       bool        touching () const { return _touching; }
+       
+       void set_touching (bool yn) { _touching = yn; }
 
        static Controllable* by_id (const PBD::ID&);
        static Controllable* by_name (const std::string&);
 
   private:
        std::string _name;
+       bool        _touching;
 
        void add ();
        void remove ();
index 08f90165bcb6606fdd80a405d5e44b0932fdbc92..204332fc4b8a83def6063e15faed2231b63c06c8 100644 (file)
@@ -182,6 +182,10 @@ MIDIControllable::midi_sense_note (Parser &p, EventTwoBytes *msg, bool is_on)
 void
 MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg)
 {
+       if (controllable.touching()) {
+               return; // to prevent feedback fights when e.g. dragging a UI slider
+       }
+
        if (control_additional == msg->controller_number) {
                if (!bistate) {
                        controllable.set_value (midi_to_control(msg->value));