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)
This commit is contained in:
Robin Gareus 2014-01-15 09:37:20 +01:00
parent 35c170937d
commit 58def58bf5
3 changed files with 44 additions and 31 deletions

View file

@ -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));
}
}
}

View file

@ -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<Signal*>::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<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)));
@ -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);