diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/delivery.cc | 6 | ||||
-rw-r--r-- | libs/ardour/speakers.cc | 10 | ||||
-rw-r--r-- | libs/ardour/vst_plugin.cc | 31 | ||||
-rw-r--r-- | libs/panners/1in2out/panner_1in2out.cc | 2 | ||||
-rw-r--r-- | libs/panners/2in2out/panner_2in2out.cc | 18 | ||||
-rw-r--r-- | libs/panners/stereobalance/panner_balance.cc | 2 | ||||
-rw-r--r-- | libs/panners/vbap/vbap.cc | 12 |
7 files changed, 53 insertions, 28 deletions
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 045417b0cc..4a392a8145 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -397,8 +397,7 @@ Delivery::reset_panner () if (panners_legal) { if (!_no_panner_reset) { - if (_panshell) { - assert (_role == Main || _role == Aux || _role == Send); + if (_panshell && _role != Insert) { _panshell->configure_io (ChanCount (DataType::AUDIO, pans_required()), ChanCount (DataType::AUDIO, pan_outs())); } } @@ -412,8 +411,7 @@ Delivery::reset_panner () void Delivery::panners_became_legal () { - if (_panshell) { - assert (_role == Main || _role == Aux || _role == Send); + if (_panshell && _role != Insert) { _panshell->configure_io (ChanCount (DataType::AUDIO, pans_required()), ChanCount (DataType::AUDIO, pan_outs())); } diff --git a/libs/ardour/speakers.cc b/libs/ardour/speakers.cc index 2acc9659ef..bbad254f6e 100644 --- a/libs/ardour/speakers.cc +++ b/libs/ardour/speakers.cc @@ -149,7 +149,7 @@ Speakers::move_speaker (int id, const AngularVector& new_position) void Speakers::setup_default_speakers (uint32_t n) { - double o = 90.0; + double o = 180.0; /* default assignment of speaker position for n speakers */ @@ -229,12 +229,12 @@ Speakers::setup_default_speakers (uint32_t n) */ if (n % 2) { - deg = 90.0 - degree_step; + deg = 360 + o + degree_step; } else { - deg = 90.0; + deg = 360 + o; } - for (i = 0; i < n; ++i, deg += degree_step) { - add_speaker (AngularVector (deg, 0.0)); + for (i = 0; i < n; ++i, deg -= degree_step) { + add_speaker (AngularVector (fmod(deg, 360), 0.0)); } } } diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 168bd0506e..f87f7b73c1 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -528,23 +528,36 @@ VSTPlugin::connect_and_run (BufferSet& bufs, { Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset); - // VC++ doesn't support this C99 extension. Use alloca instead of dynamic array (rather than std::vector which allocs on the heap) + ChanCount bufs_count; + bufs_count.set(DataType::AUDIO, 1); + bufs_count.set(DataType::MIDI, 1); + + BufferSet& silent_bufs = _session.get_silent_buffers(bufs_count); + BufferSet& scratch_bufs = _session.get_scratch_buffers(bufs_count); + float** ins = (float**)alloca(_plugin->numInputs*sizeof(float*)); float** outs = (float**)alloca(_plugin->numInputs*sizeof(float*)); - int32_t i; - const uint32_t nbufs = bufs.count().n_audio(); + int32_t i; - int in_index = 0; + uint32_t in_index = 0; for (i = 0; i < (int32_t) _plugin->numInputs; ++i) { - ins[i] = bufs.get_audio(min((uint32_t) in_index, nbufs - 1)).data() + offset; - in_index++; + uint32_t index; + bool valid = false; + index = in_map.get(DataType::AUDIO, in_index++, &valid); + ins[i] = (valid) + ? bufs.get_audio(index).data(offset) + : silent_bufs.get_audio(0).data(offset); } - int out_index = 0; + uint32_t out_index = 0; for (i = 0; i < (int32_t) _plugin->numOutputs; ++i) { - outs[i] = bufs.get_audio(min((uint32_t) out_index, nbufs - 1)).data() + offset; - out_index++; + uint32_t index; + bool valid = false; + index = out_map.get(DataType::AUDIO, out_index++, &valid); + outs[i] = (valid) + ? bufs.get_audio(index).data(offset) + : scratch_bufs.get_audio(0).data(offset); } if (bufs.count().n_midi() > 0) { diff --git a/libs/panners/1in2out/panner_1in2out.cc b/libs/panners/1in2out/panner_1in2out.cc index d92120c7aa..2d5489f0ce 100644 --- a/libs/panners/1in2out/panner_1in2out.cc +++ b/libs/panners/1in2out/panner_1in2out.cc @@ -385,7 +385,7 @@ Panner1in2out::value_as_string (boost::shared_ptr<AutomationControl> ac) const (int) rint (100.0 * val)); default: - return _pannable->value_as_string (ac); + return _("unused"); } } 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"); } } diff --git a/libs/panners/stereobalance/panner_balance.cc b/libs/panners/stereobalance/panner_balance.cc index 4794268a55..7c0d7e7ff6 100644 --- a/libs/panners/stereobalance/panner_balance.cc +++ b/libs/panners/stereobalance/panner_balance.cc @@ -321,7 +321,7 @@ Pannerbalance::value_as_string (boost::shared_ptr<AutomationControl> ac) const (int) rint (100.0 * val)); default: - return _pannable->value_as_string (ac); + return _("unused"); } } diff --git a/libs/panners/vbap/vbap.cc b/libs/panners/vbap/vbap.cc index 954711db49..3303887b95 100644 --- a/libs/panners/vbap/vbap.cc +++ b/libs/panners/vbap/vbap.cc @@ -126,7 +126,7 @@ VBAPanner::update () if (_signals.size() > 1) { double w = - (_pannable->pan_width_control->get_value()); - double signal_direction = _pannable->pan_azimuth_control->get_value() - (w/2); + double signal_direction = 1.0 - (_pannable->pan_azimuth_control->get_value() + (w/2)); double grd_step_per_signal = w / (_signals.size() - 1); for (vector<Signal*>::iterator s = _signals.begin(); s != _signals.end(); ++s) { @@ -141,7 +141,7 @@ VBAPanner::update () signal_direction += grd_step_per_signal; } } else if (_signals.size() == 1) { - double center = _pannable->pan_azimuth_control->get_value() * 360.0; + double center = (1.0 - _pannable->pan_azimuth_control->get_value()) * 360.0; /* width has no role to play if there is only 1 signal: VBAP does not do "diffusion" of a single channel */ @@ -425,7 +425,7 @@ VBAPanner::value_as_string (boost::shared_ptr<AutomationControl> ac) const switch (ac->parameter().type()) { case PanAzimuthAutomation: /* direction */ - return string_compose (_("%1\u00B0"), int (rint (val * 360.0))); + return string_compose (_("%1\u00B0"), (int (rint (val * 360.0))+180)%360); case PanWidthAutomation: /* diffusion */ return string_compose (_("%1%%"), (int) floor (100.0 * fabs(val))); @@ -434,7 +434,7 @@ VBAPanner::value_as_string (boost::shared_ptr<AutomationControl> ac) const return string_compose (_("%1\u00B0"), (int) floor (90.0 * fabs(val))); default: - return _pannable->value_as_string (ac); + return _("unused"); } } @@ -479,11 +479,11 @@ VBAPanner::set_elevation (double e) void VBAPanner::reset () { - set_position (0); + set_position (.5); if (_signals.size() > 1) { set_width (1.0 - (1.0 / (double)_signals.size())); } else { - set_width (0); + set_width (1.0); } set_elevation (0); |