summaryrefslogtreecommitdiff
path: root/libs/ardour/panner.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-11-19 00:58:57 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-11-19 00:58:57 +0000
commitd8ec9bbea79bc9cefa3e042aae8fd585f35df92b (patch)
tree440585e51ca0bb5d311a7671b5a35346871878c3 /libs/ardour/panner.cc
parente50bd9e6530d6c708a4b259de6ef19e0fc6b97c0 (diff)
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
Diffstat (limited to 'libs/ardour/panner.cc')
-rw-r--r--libs/ardour/panner.cc99
1 files changed, 53 insertions, 46 deletions
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 <glibmm.h>
+#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<Output>::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);
+ }
+}