diff --git a/gtk2_ardour/mono_panner.cc b/gtk2_ardour/mono_panner.cc index 43afcd5c84..791c3e8d0b 100644 --- a/gtk2_ardour/mono_panner.cc +++ b/gtk2_ardour/mono_panner.cc @@ -34,6 +34,7 @@ #include "ardour/panner.h" #include "ardour/panner.h" +#include "ardour/pannable.h" #include "ardour_ui.h" #include "global_signals.h" @@ -55,8 +56,9 @@ static const int top_step = 2; MonoPanner::ColorScheme MonoPanner::colors; bool MonoPanner::have_colors = false; -MonoPanner::MonoPanner (boost::shared_ptr position) - : position_control (position) +MonoPanner::MonoPanner (boost::shared_ptr panner) + : _panner (panner) + , position_control (_panner->pannable()->pan_azimuth_control) , dragging (false) , drag_start_x (0) , last_drag_x (0) @@ -64,7 +66,7 @@ MonoPanner::MonoPanner (boost::shared_ptr position) , detented (false) , drag_data_window (0) , drag_data_label (0) - , position_binder (position) + , position_binder (position_control) { if (!have_colors) { set_colors (); @@ -333,8 +335,7 @@ MonoPanner::on_button_release_event (GdkEventButton* ev) } if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) { - /* reset to default */ - position_control->set_value (0.5); + _panner->reset (); } else { StopGesture (); } diff --git a/gtk2_ardour/mono_panner.h b/gtk2_ardour/mono_panner.h index f583140af9..37a0932b99 100644 --- a/gtk2_ardour/mono_panner.h +++ b/gtk2_ardour/mono_panner.h @@ -34,7 +34,7 @@ namespace PBD { class MonoPanner : public Gtk::DrawingArea { public: - MonoPanner (boost::shared_ptr pos); + MonoPanner (boost::shared_ptr); ~MonoPanner (); boost::shared_ptr get_controllable() const { return position_control; } @@ -54,6 +54,7 @@ class MonoPanner : public Gtk::DrawingArea bool on_leave_notify_event (GdkEventCrossing* ev); private: + boost::shared_ptr _panner; boost::shared_ptr position_control; PBD::ScopedConnectionList connections; bool dragging; diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index 71a9821242..05c2843630 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -283,7 +283,7 @@ PannerUI::setup_pan () boost::shared_ptr pannable = _panner->pannable(); boost::shared_ptr ac = pannable->pan_azimuth_control; - mp = new MonoPanner (ac); + mp = new MonoPanner (_panner); mp->StartGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch), boost::weak_ptr (ac))); diff --git a/gtk2_ardour/stereo_panner.cc b/gtk2_ardour/stereo_panner.cc index 690acbfdda..e55d2c1b20 100644 --- a/gtk2_ardour/stereo_panner.cc +++ b/gtk2_ardour/stereo_panner.cc @@ -418,7 +418,7 @@ StereoPanner::on_button_release_event (GdkEventButton* ev) return false; } - bool dp = dragging_position; + bool const dp = dragging_position; dragging = false; dragging_position = false; @@ -432,9 +432,7 @@ StereoPanner::on_button_release_event (GdkEventButton* ev) } if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) { - /* reset to default */ - position_control->set_value (0.5); - width_control->set_value (1.0); + _panner->reset (); } else { if (dp) { StopPositionGesture (); diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index f770a181c1..6f54ea7d79 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -81,7 +81,7 @@ public: virtual PBD::AngularVector signal_position (uint32_t) const { return PBD::AngularVector(); } - virtual void reset() {} + virtual void reset () = 0; void set_automation_state (AutoState); AutoState automation_state() const; diff --git a/libs/panners/1in2out/panner_1in2out.cc b/libs/panners/1in2out/panner_1in2out.cc index 19b8dadd6d..2fb2df7e9a 100644 --- a/libs/panners/1in2out/panner_1in2out.cc +++ b/libs/panners/1in2out/panner_1in2out.cc @@ -373,3 +373,10 @@ Panner1in2out::value_as_string (boost::shared_ptr ac) const return _pannable->value_as_string (ac); } } + +void +Panner1in2out::reset () +{ + set_position (0.5); + update (); +} diff --git a/libs/panners/1in2out/panner_1in2out.h b/libs/panners/1in2out/panner_1in2out.h index bd1b1a9c12..13b48fa839 100644 --- a/libs/panners/1in2out/panner_1in2out.h +++ b/libs/panners/1in2out/panner_1in2out.h @@ -58,6 +58,8 @@ class Panner1in2out : public Panner XMLNode& get_state (); + void reset (); + protected: float left; float right; diff --git a/libs/panners/2in2out/panner_2in2out.cc b/libs/panners/2in2out/panner_2in2out.cc index 1ac3974c49..c9dac08cf1 100644 --- a/libs/panners/2in2out/panner_2in2out.cc +++ b/libs/panners/2in2out/panner_2in2out.cc @@ -490,3 +490,11 @@ Panner2in2out::value_as_string (boost::shared_ptr ac) const return _pannable->value_as_string (ac); } } + +void +Panner2in2out::reset () +{ + set_position (0.5); + set_width (1); + update (); +} diff --git a/libs/panners/2in2out/panner_2in2out.h b/libs/panners/2in2out/panner_2in2out.h index 48f441fbd0..232d63ec62 100644 --- a/libs/panners/2in2out/panner_2in2out.h +++ b/libs/panners/2in2out/panner_2in2out.h @@ -66,6 +66,8 @@ class Panner2in2out : public Panner void update (); + void reset (); + protected: float left[2]; float right[2]; diff --git a/libs/panners/vbap/vbap.cc b/libs/panners/vbap/vbap.cc index 59f8cddb62..f9ad5efed7 100644 --- a/libs/panners/vbap/vbap.cc +++ b/libs/panners/vbap/vbap.cc @@ -473,3 +473,12 @@ VBAPanner::set_width (double w) { _pannable->pan_width_control->set_value (min (1.0, max (-1.0, w))); } + +void +VBAPanner::reset () +{ + set_position (0); + set_width (1); + + update (); +} diff --git a/libs/panners/vbap/vbap.h b/libs/panners/vbap/vbap.h index 752a0c9be6..e90bbc6fb1 100644 --- a/libs/panners/vbap/vbap.h +++ b/libs/panners/vbap/vbap.h @@ -63,6 +63,8 @@ public: PBD::AngularVector signal_position (uint32_t n) const; boost::shared_ptr get_speakers() const; + void reset (); + private: struct Signal { PBD::AngularVector direction;