X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpanners%2F2in2out%2Fpanner_2in2out.cc;h=f18dd94f45a6ef706602f301ff27443fac39cb54;hb=6acdfc69b785841ac10a324484ddd0208612a213;hp=6740f56e6578eb4cf2c8b61b1bd0be5a8dc37d1b;hpb=19bb2b33a89a1291451f0740739a36daebe00bae;p=ardour.git diff --git a/libs/panners/2in2out/panner_2in2out.cc b/libs/panners/2in2out/panner_2in2out.cc index 6740f56e65..f18dd94f45 100644 --- a/libs/panners/2in2out/panner_2in2out.cc +++ b/libs/panners/2in2out/panner_2in2out.cc @@ -49,7 +49,6 @@ #include "ardour/runtime_functions.h" #include "ardour/session.h" #include "ardour/utils.h" -#include "ardour/visibility.h" #include "ardour/mix.h" #include "panner_2in2out.h" @@ -64,7 +63,10 @@ using namespace PBD; static PanPluginDescriptor _descriptor = { "Equal Power Stereo", + "http://ardour.org/plugin/panner_2in2out", + "http://ardour.org/plugin/panner_2in2out#ui", 2, 2, + 10000, Panner2in2out::factory }; @@ -76,7 +78,14 @@ Panner2in2out::Panner2in2out (boost::shared_ptr p) if (!_pannable->has_state()) { _pannable->pan_azimuth_control->set_value (0.5); _pannable->pan_width_control->set_value (1.0); - } + } + + double const w = width(); + double const wrange = min (position(), (1 - position())) * 2; + if (fabs(w) > wrange) { + set_width(w > 0 ? wrange : -wrange); + } + update (); @@ -156,6 +165,11 @@ Panner2in2out::update () double width = this->width (); const double direction_as_lr_fract = position (); + double const wrange = min (position(), (1 - position())) * 2; + if (fabs(width) > wrange) { + width = (width > 0 ? wrange : -wrange); + } + if (width < 0.0) { width = -width; pos[0] = direction_as_lr_fract + (width/2.0); // left signal lr_fract @@ -419,6 +433,8 @@ Panner2in2out::distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs, panR = position[n] + (width[n]/2.0f); // center - width/2 } + panR = max(0.f, min(1.f, panR)); + const float panL = 1 - panR; /* note that are overwriting buffers, but its OK @@ -465,6 +481,8 @@ XMLNode& Panner2in2out::get_state () { XMLNode& root (Panner::get_state ()); + root.add_property (X_("uri"), _descriptor.panner_uri); + /* this is needed to allow new sessions to load with old Ardour: */ root.add_property (X_("type"), _descriptor.name); return root; } @@ -518,7 +536,7 @@ Panner2in2out::value_as_string (boost::shared_ptr ac) const return string_compose (_("Width: %1%%"), (int) floor (100.0 * val)); default: - return _pannable->value_as_string (ac); + return _("unused"); } }