diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-01-27 01:31:03 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-01-27 01:31:03 +0000 |
commit | 15b5fce90480490455237da917167b0bcb5ce946 (patch) | |
tree | 5c1c5929a83c05db1a901e775fefe4f6cf8dc1b7 /libs/panners/2in2out | |
parent | 1385643131a2b2231bbbc0c584c76883fcfb580a (diff) |
merge 3.0-panexp (pan experiments) branch, revisions 8534-8585 into 3.0, thus ending 3.0-panexp. THIS COMMIT WILL BREAK ALL EXISTING 3.0 SESSIONS IN SOME WAY (possibly not fatally).
git-svn-id: svn://localhost/ardour2/branches/3.0@8586 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/panners/2in2out')
-rw-r--r-- | libs/panners/2in2out/panner_2in2out.cc | 82 | ||||
-rw-r--r-- | libs/panners/2in2out/panner_2in2out.h | 4 | ||||
-rw-r--r-- | libs/panners/2in2out/wscript | 6 |
3 files changed, 58 insertions, 34 deletions
diff --git a/libs/panners/2in2out/panner_2in2out.cc b/libs/panners/2in2out/panner_2in2out.cc index 6bc0f93a8f..2c2856361c 100644 --- a/libs/panners/2in2out/panner_2in2out.cc +++ b/libs/panners/2in2out/panner_2in2out.cc @@ -71,21 +71,21 @@ extern "C" { PanPluginDescriptor* panner_descriptor () { return &_descriptor; } Panner2in2out::Panner2in2out (boost::shared_ptr<Pannable> p) : Panner (p) { - _pannable->pan_azimuth_control->set_value (0.5); - _pannable->pan_width_control->set_value (1.0); - - /* LEFT SIGNAL, panned hard left */ - left[0] = 1.0; - right[0] = 0.0; - desired_left[0] = left_interp[0] = left[0]; - desired_right[0] = right_interp[0] = right[0]; - - /* RIGHT SIGNAL, panned hard right */ - left[1] = 0; - right[1] = 1.0; - desired_left[1] = left_interp[1] = left[1]; - desired_right[1] = right_interp[1] = right[1]; - + if (!_pannable->has_state()) { + _pannable->pan_azimuth_control->set_value (0.5); + _pannable->pan_width_control->set_value (1.0); + } + + update (); + + /* LEFT SIGNAL */ + left_interp[0] = left[0] = desired_left[0]; + right_interp[0] = right[0] = desired_right[0]; + + /* RIGHT SIGNAL */ + left_interp[1] = left[1] = desired_left[1]; + right_interp[1] = right[1] = desired_right[1]; + _pannable->pan_azimuth_control->Changed.connect_same_thread (*this, boost::bind (&Panner2in2out::update, this)); _pannable->pan_width_control->Changed.connect_same_thread (*this, boost::bind (&Panner2in2out::update, this)); } @@ -141,8 +141,6 @@ Panner2in2out::update () const double width = _pannable->pan_width_control->get_value(); const double direction_as_lr_fract = _pannable->pan_azimuth_control->get_value(); - cerr << "new pan values width=" << width << " LR = " << direction_as_lr_fract << endl; - if (width < 0.0) { pos[0] = direction_as_lr_fract + (width/2.0); // left signal lr_fract pos[1] = direction_as_lr_fract - (width/2.0); // right signal lr_fract @@ -190,20 +188,14 @@ Panner2in2out::clamp_width (double& w) bool Panner2in2out::clamp_stereo_pan (double& direction_as_lr_fract, double& width) { - double r_pos = direction_as_lr_fract + (width/2.0); - double l_pos = direction_as_lr_fract - (width/2.0); - bool can_move_left = true; - bool can_move_right = true; - - cerr << "Clamp pos = " << direction_as_lr_fract << " w = " << width << endl; + double r_pos; + double l_pos; - if (width > 1.0 || width < 1.0) { - return false; - } + width = max (min (width, 1.0), -1.0); + direction_as_lr_fract = max (min (direction_as_lr_fract, 1.0), 0.0); - if (direction_as_lr_fract > 1.0 || direction_as_lr_fract < 0.0) { - return false; - } + r_pos = direction_as_lr_fract + (width/2.0); + l_pos = direction_as_lr_fract - (width/2.0); if (width < 0.0) { swap (r_pos, l_pos); @@ -213,19 +205,20 @@ Panner2in2out::clamp_stereo_pan (double& direction_as_lr_fract, double& width) is already there, we're not moving the left signal. */ - if (l_pos <= 0.0 && desired_left[0] <= 0.0) { - can_move_left = false; + if (l_pos < 0.0) { + return false; } /* if the new right position is less than or equal to 1.0 (hard right) and the right panner is already there, we're not moving the right signal. */ - if (r_pos >= 1.0 && desired_right[1] >= 1.0) { - can_move_right = false; + if (r_pos > 1.0) { + return false; + } - return can_move_left && can_move_right; + return true; } void @@ -459,3 +452,24 @@ Panner2in2out::set_state (const XMLNode& node, int version) return 0; } +std::set<Evoral::Parameter> +Panner2in2out::what_can_be_automated() const +{ + set<Evoral::Parameter> s; + s.insert (Evoral::Parameter (PanAzimuthAutomation)); + s.insert (Evoral::Parameter (PanWidthAutomation)); + return s; +} + +string +Panner2in2out::describe_parameter (Evoral::Parameter p) +{ + switch (p.type()) { + case PanAzimuthAutomation: + return _("L/R"); + case PanWidthAutomation: + return _("Width"); + default: + return _pannable->describe_parameter (p); + } +} diff --git a/libs/panners/2in2out/panner_2in2out.h b/libs/panners/2in2out/panner_2in2out.h index 8d8d57d709..0bb38fa27f 100644 --- a/libs/panners/2in2out/panner_2in2out.h +++ b/libs/panners/2in2out/panner_2in2out.h @@ -55,8 +55,12 @@ class Panner2in2out : public Panner double position () const; double width () const; + std::set<Evoral::Parameter> what_can_be_automated() const; + static Panner* factory (boost::shared_ptr<Pannable>, Speakers&); + std::string describe_parameter (Evoral::Parameter); + XMLNode& state (bool full_state); XMLNode& get_state (void); int set_state (const XMLNode&, int version); diff --git a/libs/panners/2in2out/wscript b/libs/panners/2in2out/wscript index 509848e5a6..22d5c03726 100644 --- a/libs/panners/2in2out/wscript +++ b/libs/panners/2in2out/wscript @@ -12,6 +12,12 @@ LIBARDOUR_PAN2IN2OUT_LIB_VERSION = '1.0.0' srcdir = '.' blddir = 'build' +def set_options(opt): + autowaf.set_options(opt) + +def configure(conf): + autowaf.configure(conf) + def build(bld): obj = bld.new_task_gen('cxx', 'shlib') obj.source = [ 'panner_2in2out.cc' ] |