From 58def58bf50f29e42babdb5de7ca34819c00909f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Jan 2014 09:37:20 +0100 Subject: VBAP GUI convention: top == front ^= azimuth == .5 This allows to move from stereo,mono panners to VBAP and back and also facilitates sharing pannables of all currently existing panners with semantically similar results. (somewhat dirty solution, this retains PBD::spherical_to_cartesian and maps angles pretty much everywhere else) --- libs/ardour/speakers.cc | 10 +++++----- libs/panners/vbap/vbap.cc | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'libs') 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/panners/vbap/vbap.cc b/libs/panners/vbap/vbap.cc index e15e2abb4c..2ab91cf3c4 100644 --- a/libs/panners/vbap/vbap.cc +++ b/libs/panners/vbap/vbap.cc @@ -122,7 +122,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::iterator s = _signals.begin(); s != _signals.end(); ++s) { @@ -137,7 +137,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 */ @@ -421,7 +421,7 @@ VBAPanner::value_as_string (boost::shared_ptr 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))); @@ -475,11 +475,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); -- cgit v1.2.3 From a4dc05f603c5de1748752eb6e078a2415f17532f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Jan 2014 09:45:02 +0100 Subject: fix invalid width when swiching to 2in2out --- libs/panners/2in2out/panner_2in2out.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/panners/2in2out/panner_2in2out.cc b/libs/panners/2in2out/panner_2in2out.cc index f801a36ff4..463b2671bb 100644 --- a/libs/panners/2in2out/panner_2in2out.cc +++ b/libs/panners/2in2out/panner_2in2out.cc @@ -78,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 (); -- cgit v1.2.3 From d27d6e673f6381947789e5934b42381f5b52847f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Jan 2014 10:37:25 +0100 Subject: re-allow panners for monitoring-section (for now) --- libs/ardour/delivery.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 045417b0cc..82e025845e 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -398,7 +398,7 @@ Delivery::reset_panner () if (!_no_panner_reset) { if (_panshell) { - assert (_role == Main || _role == Aux || _role == Send); + assert (_role == Main || _role == Aux || _role == Send || _role == Listen); _panshell->configure_io (ChanCount (DataType::AUDIO, pans_required()), ChanCount (DataType::AUDIO, pan_outs())); } } @@ -413,7 +413,7 @@ void Delivery::panners_became_legal () { if (_panshell) { - assert (_role == Main || _role == Aux || _role == Send); + assert (_role == Main || _role == Aux || _role == Send || _role == Listen); _panshell->configure_io (ChanCount (DataType::AUDIO, pans_required()), ChanCount (DataType::AUDIO, pan_outs())); } -- cgit v1.2.3 From abb75d4a2eeafc9894011998cb263449c55bc4e0 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Jan 2014 10:38:32 +0100 Subject: prevent stackoverflow when pannable changes to fewer params endless loop: e.g. 2in2out -> balance (or 1in1out) #23 0xb7ab5c17 in ARDOUR::Pannable::value_as_string #24 0xb2ebb206 in ARDOUR::Pannerbalance::value_as_string #25 0xb7ab5c17 in ARDOUR::Pannable::value_as_string #26 0xb2ebb206 in ARDOUR::Pannerbalance::value_as_string ad infinitum --- libs/panners/1in2out/panner_1in2out.cc | 2 +- libs/panners/2in2out/panner_2in2out.cc | 2 +- libs/panners/stereobalance/panner_balance.cc | 2 +- libs/panners/vbap/vbap.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libs') diff --git a/libs/panners/1in2out/panner_1in2out.cc b/libs/panners/1in2out/panner_1in2out.cc index 12e7896cfb..4dd21493e6 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 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 463b2671bb..860610ecfc 100644 --- a/libs/panners/2in2out/panner_2in2out.cc +++ b/libs/panners/2in2out/panner_2in2out.cc @@ -529,7 +529,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"); } } diff --git a/libs/panners/stereobalance/panner_balance.cc b/libs/panners/stereobalance/panner_balance.cc index d5ab96b73c..b7d8a2a031 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 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 2ab91cf3c4..b092be29d0 100644 --- a/libs/panners/vbap/vbap.cc +++ b/libs/panners/vbap/vbap.cc @@ -430,7 +430,7 @@ VBAPanner::value_as_string (boost::shared_ptr ac) const return string_compose (_("%1\u00B0"), (int) floor (90.0 * fabs(val))); default: - return _pannable->value_as_string (ac); + return _("unused"); } } -- cgit v1.2.3 From c8f94053866c3c0f1e796ca2e7fad36266534640 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Jan 2014 14:07:02 +0100 Subject: stereo-panner: clamp width during processing to valid range --- libs/panners/2in2out/panner_2in2out.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libs') diff --git a/libs/panners/2in2out/panner_2in2out.cc b/libs/panners/2in2out/panner_2in2out.cc index 860610ecfc..25ea1c401a 100644 --- a/libs/panners/2in2out/panner_2in2out.cc +++ b/libs/panners/2in2out/panner_2in2out.cc @@ -165,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 @@ -428,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 -- cgit v1.2.3 From b06fa27ccb06f4c5430acab3feaea656891beaae Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Jan 2014 14:55:26 +0100 Subject: rework LXVST port assignments - fixes #5827 --- libs/ardour/vst_plugin.cc | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'libs') diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index cb40d6eac8..729ee5c129 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -528,22 +528,35 @@ VSTPlugin::connect_and_run (BufferSet& bufs, { Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset); + 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[_plugin->numInputs]; float *outs[_plugin->numOutputs]; int32_t i; - const uint32_t nbufs = bufs.count().n_audio(); - - 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) { -- cgit v1.2.3 From f9a5f8700332e71e9647a83626e5a37409d6e2a8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Jan 2014 17:59:16 +0100 Subject: don't pan send/return inserts --- libs/ardour/delivery.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'libs') diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 82e025845e..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 || _role == Listen); + 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 || _role == Listen); + if (_panshell && _role != Insert) { _panshell->configure_io (ChanCount (DataType::AUDIO, pans_required()), ChanCount (DataType::AUDIO, pan_outs())); } -- cgit v1.2.3