From cbb59ddbce3f53798e83f5a88b3f38fa3a713592 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 18 Feb 2009 23:54:41 +0000 Subject: [PATCH] Fix 'sticky' sliders when MIDI control feedback is enabled. git-svn-id: svn://localhost/ardour2/branches/3.0@4628 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/gain_meter.cc | 4 ++-- libs/ardour/ardour/automation_control.h | 2 ++ libs/pbd/controllable.cc | 1 + libs/pbd/pbd/controllable.h | 6 +++++- libs/surfaces/generic_midi/midicontrollable.cc | 4 ++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 429331178c..85562bac0e 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -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; } diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index d3a220efbc..e4b024a290 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -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(); } diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc index c79e0cb3d8..4788965c97 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -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; diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index 9fa374ebc6..6d37464419 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -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 (); diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc index 08f90165bc..204332fc4b 100644 --- a/libs/surfaces/generic_midi/midicontrollable.cc +++ b/libs/surfaces/generic_midi/midicontrollable.cc @@ -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));