From d8ec9bbea79bc9cefa3e042aae8fd585f35df92b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 19 Nov 2010 00:58:57 +0000 Subject: non-crashing (but also non-functional) integration of VBAP with panner "architecture" git-svn-id: svn://localhost/ardour2/branches/3.0@8056 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/panner.cc | 99 +++++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 46 deletions(-) (limited to 'libs/ardour/panner.cc') diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index 8ce12caf69..55d1e5f751 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -32,6 +32,7 @@ #include +#include "pbd/cartesian.h" #include "pbd/error.h" #include "pbd/failed_constructor.h" #include "pbd/xml++.h" @@ -47,6 +48,7 @@ #include "ardour/runtime_functions.h" #include "ardour/buffer_set.h" #include "ardour/audio_buffer.h" +#include "ardour/vbap.h" #include "i18n.h" @@ -947,58 +949,19 @@ Panner::reset (uint32_t nouts, uint32_t npans) case 2: // line outputs.push_back (Output (0, 0)); outputs.push_back (Output (1.0, 0)); - for (n = 0; n < npans; ++n) { _streampanners.push_back (new EqualPowerStereoPanner (*this, Evoral::Parameter(PanAutomation, 0, n))); } - break; - - case 3: // triangle - outputs.push_back (Output (0.5, 0)); - outputs.push_back (Output (0, 1.0)); - outputs.push_back (Output (1.0, 1.0)); + break; + case 3: + case 4: + case 5: + default: + setup_speakers (nouts); for (n = 0; n < npans; ++n) { - _streampanners.push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, 0, n))); + _streampanners.push_back (new VBAPanner (*this, Evoral::Parameter(PanAutomation, 0, n), _session.get_speakers())); } - - break; - - case 4: // square - outputs.push_back (Output (0, 0)); - outputs.push_back (Output (1.0, 0)); - outputs.push_back (Output (1.0, 1.0)); - outputs.push_back (Output (0, 1.0)); - - for (n = 0; n < npans; ++n) { - _streampanners.push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, 0, n))); - } - - break; - - case 5: //square+offcenter center - outputs.push_back (Output (0, 0)); - outputs.push_back (Output (1.0, 0)); - outputs.push_back (Output (1.0, 1.0)); - outputs.push_back (Output (0, 1.0)); - outputs.push_back (Output (0.5, 0.75)); - - for (n = 0; n < npans; ++n) { - _streampanners.push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, 0, n))); - } - - break; - - default: - /* XXX horrible placement. FIXME */ - for (n = 0; n < nouts; ++n) { - outputs.push_back (Output (0.1 * n, 0.1 * n)); - } - - for (n = 0; n < npans; ++n) { - _streampanners.push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, 0, n))); - } - break; } @@ -1669,3 +1632,47 @@ Panner::value_as_string (double v) return ""; } + +void +Panner::setup_speakers (uint32_t nouts) +{ + switch (nouts) { + case 3: + outputs.push_back (Output (0.5, 0)); + outputs.push_back (Output (0, 1.0)); + outputs.push_back (Output (1.0, 1.0)); + break; + case 4: + outputs.push_back (Output (0, 0)); + outputs.push_back (Output (1.0, 0)); + outputs.push_back (Output (1.0, 1.0)); + outputs.push_back (Output (0, 1.0)); + break; + + case 5: //square+offcenter center + outputs.push_back (Output (0, 0)); + outputs.push_back (Output (1.0, 0)); + outputs.push_back (Output (1.0, 1.0)); + outputs.push_back (Output (0, 1.0)); + outputs.push_back (Output (0.5, 0.75)); + break; + + default: + /* XXX horrible placement. FIXME */ + for (uint32_t n = 0; n < nouts; ++n) { + outputs.push_back (Output (0.1 * n, 0.1 * n)); + } + } + + VBAPSpeakers& speakers (_session.get_speakers()); + + speakers.clear_speakers (); + + for (vector::iterator o = outputs.begin(); o != outputs.end(); ++o) { + double azimuth; + double elevation; + + cart_to_azi_ele ((*o).x + 1.0, (*o).y + 1.0, (*o).z, azimuth, elevation); + speakers.add_speaker (azimuth, elevation); + } +} -- cgit v1.2.3