diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-01-15 14:29:32 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-01-15 14:29:32 -0500 |
commit | 9aacefc17010a889222425f97b99050171165038 (patch) | |
tree | a1a80ed3557caa2b223274fd33f54df35252ee5f /libs/panners/2in2out | |
parent | 96586e81f40e883a7807c88eaa7df73b60140352 (diff) | |
parent | 79b56b1d3319d03d14b2d3e2f8d6cd7b3e797deb (diff) |
merge with master
Diffstat (limited to 'libs/panners/2in2out')
-rw-r--r-- | libs/panners/2in2out/panner_2in2out.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libs/panners/2in2out/panner_2in2out.cc b/libs/panners/2in2out/panner_2in2out.cc index a10c4adc29..f18dd94f45 100644 --- a/libs/panners/2in2out/panner_2in2out.cc +++ b/libs/panners/2in2out/panner_2in2out.cc @@ -78,7 +78,14 @@ Panner2in2out::Panner2in2out (boost::shared_ptr<Pannable> 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 (); @@ -158,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 @@ -421,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 @@ -522,7 +536,7 @@ Panner2in2out::value_as_string (boost::shared_ptr<AutomationControl> ac) const return string_compose (_("Width: %1%%"), (int) floor (100.0 * val)); default: - return _pannable->value_as_string (ac); + return _("unused"); } } |