mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 00:34:59 +01:00
Fix more broken indentation (whitespace changes only).
git-svn-id: svn://localhost/ardour2/branches/3.0@8094 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
1445bf5fc5
commit
a8d4e33d1b
17 changed files with 1375 additions and 1376 deletions
|
|
@ -44,7 +44,7 @@ using Gtkmm2ext::Keyboard;
|
|||
Panner2d::Target::Target (const AngularVector& a, const char *txt)
|
||||
: position (a)
|
||||
, text (txt)
|
||||
, _selected (false)
|
||||
, _selected (false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ Panner2d::handle_position_change ()
|
|||
}
|
||||
|
||||
for (n = 0; n < targets.size(); ++n) {
|
||||
targets[n]->position = panner->output(n).position;
|
||||
targets[n]->position = panner->output(n).position;
|
||||
}
|
||||
|
||||
queue_draw ();
|
||||
|
|
@ -238,20 +238,20 @@ Panner2d::find_closest_object (gdouble x, gdouble y, int& which) const
|
|||
which = 0;
|
||||
pwhich = 0;
|
||||
|
||||
cerr << "@ " << x << ", " << y << endl;
|
||||
cerr << "@ " << x << ", " << y << endl;
|
||||
|
||||
for (Targets::const_iterator i = pucks.begin(); i != pucks.end(); ++i, ++pwhich) {
|
||||
candidate = *i;
|
||||
|
||||
CartesianVector c;
|
||||
CartesianVector c;
|
||||
|
||||
candidate->position.cartesian (c);
|
||||
cart_to_gtk (c);
|
||||
candidate->position.cartesian (c);
|
||||
cart_to_gtk (c);
|
||||
|
||||
distance = sqrt ((c.x - x) * (c.x - x) +
|
||||
(c.y - y) * (c.y - y));
|
||||
(c.y - y) * (c.y - y));
|
||||
|
||||
cerr << "\tConsider candiate " << candidate->text << " @ " << c.x << ", " << c.y << ", " << c.z << " distance = " << distance << endl;
|
||||
cerr << "\tConsider candiate " << candidate->text << " @ " << c.x << ", " << c.y << ", " << c.z << " distance = " << distance << endl;
|
||||
|
||||
if (distance < best_distance) {
|
||||
closest = candidate;
|
||||
|
|
@ -261,11 +261,11 @@ Panner2d::find_closest_object (gdouble x, gdouble y, int& which) const
|
|||
}
|
||||
|
||||
|
||||
if (best_distance > 20) { // arbitrary
|
||||
return 0;
|
||||
}
|
||||
if (best_distance > 20) { // arbitrary
|
||||
return 0;
|
||||
}
|
||||
|
||||
cerr << "the winner is " << closest->text << endl;
|
||||
cerr << "the winner is " << closest->text << endl;
|
||||
|
||||
return closest;
|
||||
}
|
||||
|
|
@ -309,20 +309,20 @@ Panner2d::on_expose_event (GdkEventExpose *event)
|
|||
cairo_translate (cr, 10.0, 10.0);
|
||||
}
|
||||
|
||||
/* horizontal line of "crosshairs" */
|
||||
/* horizontal line of "crosshairs" */
|
||||
|
||||
cairo_set_source_rgb (cr, 0.0, 0.1, 0.7);
|
||||
cairo_move_to (cr, 0.5, height/2.0+0.5);
|
||||
cairo_line_to (cr, width+0.5, height/2+0.5);
|
||||
cairo_stroke (cr);
|
||||
|
||||
/* vertical line of "crosshairs" */
|
||||
|
||||
/* vertical line of "crosshairs" */
|
||||
|
||||
cairo_move_to (cr, width/2+0.5, 0.5);
|
||||
cairo_line_to (cr, width/2+0.5, height+0.5);
|
||||
cairo_stroke (cr);
|
||||
|
||||
/* the circle on which signals live */
|
||||
/* the circle on which signals live */
|
||||
|
||||
cairo_arc (cr, width/2, height/2, height/2, 0, 2.0 * M_PI);
|
||||
cairo_stroke (cr);
|
||||
|
|
@ -347,15 +347,15 @@ Panner2d::on_expose_event (GdkEventExpose *event)
|
|||
if (puck->visible) {
|
||||
/* redraw puck */
|
||||
|
||||
CartesianVector c;
|
||||
CartesianVector c;
|
||||
|
||||
puck->position.cartesian (c);
|
||||
cart_to_gtk (c);
|
||||
puck->position.cartesian (c);
|
||||
cart_to_gtk (c);
|
||||
|
||||
x = (gint) floor (c.x);
|
||||
y = (gint) floor (c.y);
|
||||
x = (gint) floor (c.x);
|
||||
y = (gint) floor (c.y);
|
||||
|
||||
/* XXX need to shift circles so that they are centered on the circle */
|
||||
/* XXX need to shift circles so that they are centered on the circle */
|
||||
|
||||
cairo_arc (cr, x, y, arc_radius, 0, 2.0 * M_PI);
|
||||
cairo_set_source_rgb (cr, 0.8, 0.2, 0.1);
|
||||
|
|
@ -364,8 +364,8 @@ Panner2d::on_expose_event (GdkEventExpose *event)
|
|||
|
||||
cairo_move_to (cr, x + 6, y + 6);
|
||||
|
||||
char buf[256];
|
||||
snprintf (buf, sizeof (buf), "%s:%d", puck->text.c_str(), (int) lrint (puck->position.azi));
|
||||
char buf[256];
|
||||
snprintf (buf, sizeof (buf), "%s:%d", puck->text.c_str(), (int) lrint (puck->position.azi));
|
||||
cairo_show_text (cr, buf);
|
||||
}
|
||||
}
|
||||
|
|
@ -381,13 +381,13 @@ Panner2d::on_expose_event (GdkEventExpose *event)
|
|||
|
||||
if (target->visible) {
|
||||
|
||||
CartesianVector c;
|
||||
CartesianVector c;
|
||||
|
||||
target->position.cartesian (c);
|
||||
cart_to_gtk (c);
|
||||
target->position.cartesian (c);
|
||||
cart_to_gtk (c);
|
||||
|
||||
x = (int) floor (c.x);
|
||||
y = (int) floor (c.y);
|
||||
x = (int) floor (c.x);
|
||||
y = (int) floor (c.y);
|
||||
|
||||
snprintf (buf, sizeof (buf), "%d", n);
|
||||
|
||||
|
|
@ -419,8 +419,8 @@ Panner2d::on_button_press_event (GdkEventButton *ev)
|
|||
case 1:
|
||||
case 2:
|
||||
if ((drag_target = find_closest_object (ev->x, ev->y, drag_index)) != 0) {
|
||||
drag_target->set_selected (true);
|
||||
}
|
||||
drag_target->set_selected (true);
|
||||
}
|
||||
|
||||
drag_x = (int) floor (ev->x);
|
||||
drag_y = (int) floor (ev->y);
|
||||
|
|
@ -458,7 +458,7 @@ Panner2d::on_button_release_event (GdkEventButton *ev)
|
|||
|
||||
queue_draw ();
|
||||
PuckMoved (-1);
|
||||
ret = true;
|
||||
ret = true;
|
||||
|
||||
} else {
|
||||
ret = handle_motion (x, y, state);
|
||||
|
|
@ -503,33 +503,32 @@ Panner2d::handle_motion (gint evx, gint evy, GdkModifierType state)
|
|||
|
||||
|
||||
if (state & GDK_BUTTON1_MASK && !(state & GDK_BUTTON2_MASK)) {
|
||||
|
||||
CartesianVector c;
|
||||
bool need_move = false;
|
||||
CartesianVector c;
|
||||
bool need_move = false;
|
||||
|
||||
drag_target->position.cartesian (c);
|
||||
cart_to_gtk (c);
|
||||
drag_target->position.cartesian (c);
|
||||
cart_to_gtk (c);
|
||||
|
||||
if ((evx != c.x) || (evy != c.y)) {
|
||||
need_move = true;
|
||||
}
|
||||
if ((evx != c.x) || (evy != c.y)) {
|
||||
need_move = true;
|
||||
}
|
||||
|
||||
if (need_move) {
|
||||
CartesianVector cp (evx, evy, 0.0);
|
||||
if (need_move) {
|
||||
CartesianVector cp (evx, evy, 0.0);
|
||||
|
||||
/* canonicalize position */
|
||||
/* canonicalize position */
|
||||
|
||||
gtk_to_cart (cp);
|
||||
gtk_to_cart (cp);
|
||||
|
||||
/* position actual signal on circle */
|
||||
/* position actual signal on circle */
|
||||
|
||||
clamp_to_circle (cp.x, cp.y);
|
||||
clamp_to_circle (cp.x, cp.y);
|
||||
|
||||
/* generate an angular representation and set drag target (GUI) position */
|
||||
/* generate an angular representation and set drag target (GUI) position */
|
||||
|
||||
cp.angular (drag_target->position); /* sets drag target position */
|
||||
cp.angular (drag_target->position); /* sets drag target position */
|
||||
|
||||
panner->streampanner (drag_index).set_position (drag_target->position);
|
||||
panner->streampanner (drag_index).set_position (drag_target->position);
|
||||
|
||||
queue_draw ();
|
||||
}
|
||||
|
|
@ -541,43 +540,43 @@ Panner2d::handle_motion (gint evx, gint evy, GdkModifierType state)
|
|||
void
|
||||
Panner2d::cart_to_gtk (CartesianVector& c) const
|
||||
{
|
||||
/* "c" uses a coordinate space that is:
|
||||
/* "c" uses a coordinate space that is:
|
||||
|
||||
center = 0.0
|
||||
dimension = 2.0 * 2.0
|
||||
so max values along each axis are -1..+1
|
||||
center = 0.0
|
||||
dimension = 2.0 * 2.0
|
||||
so max values along each axis are -1..+1
|
||||
|
||||
GTK uses a coordinate space that is:
|
||||
GTK uses a coordinate space that is:
|
||||
|
||||
top left = 0.0
|
||||
dimension = width * height
|
||||
so max values along each axis are 0,width and
|
||||
0,height
|
||||
*/
|
||||
top left = 0.0
|
||||
dimension = width * height
|
||||
so max values along each axis are 0,width and
|
||||
0,height
|
||||
*/
|
||||
|
||||
c.x = (width / 2) * (c.x + 1);
|
||||
c.y = (height / 2) * (1 - c.y);
|
||||
c.x = (width / 2) * (c.x + 1);
|
||||
c.y = (height / 2) * (1 - c.y);
|
||||
|
||||
/* XXX z-axis not handled - 2D for now */
|
||||
/* XXX z-axis not handled - 2D for now */
|
||||
}
|
||||
|
||||
void
|
||||
Panner2d::gtk_to_cart (CartesianVector& c) const
|
||||
{
|
||||
c.x = (c.x / (width / 2.0)) - 1.0;
|
||||
c.y = -((c.y / (height / 2.0)) - 1.0);
|
||||
c.x = (c.x / (width / 2.0)) - 1.0;
|
||||
c.y = -((c.y / (height / 2.0)) - 1.0);
|
||||
|
||||
/* XXX z-axis not handled - 2D for now */
|
||||
/* XXX z-axis not handled - 2D for now */
|
||||
}
|
||||
|
||||
void
|
||||
Panner2d::clamp_to_circle (double& x, double& y)
|
||||
{
|
||||
double azi, ele;
|
||||
double z = 0.0;
|
||||
double azi, ele;
|
||||
double z = 0.0;
|
||||
|
||||
PBD::cart_to_azi_ele (x, y, z, azi, ele);
|
||||
PBD::azi_ele_to_cart (azi, ele, x, y, z);
|
||||
PBD::cart_to_azi_ele (x, y, z, azi, ele);
|
||||
PBD::azi_ele_to_cart (azi, ele, x, y, z);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ class Panner2d : public Gtk::DrawingArea
|
|||
sigc::signal<void,int> PuckMoved;
|
||||
sigc::signal<void,int> TargetMoved;
|
||||
|
||||
void cart_to_gtk (PBD::CartesianVector&) const;
|
||||
void gtk_to_cart (PBD::CartesianVector&) const;
|
||||
void cart_to_gtk (PBD::CartesianVector&) const;
|
||||
void gtk_to_cart (PBD::CartesianVector&) const;
|
||||
|
||||
protected:
|
||||
bool on_expose_event (GdkEventExpose *);
|
||||
|
|
@ -79,24 +79,24 @@ class Panner2d : public Gtk::DrawingArea
|
|||
|
||||
private:
|
||||
class Target {
|
||||
public:
|
||||
PBD::AngularVector position;
|
||||
bool visible;
|
||||
std::string text;
|
||||
public:
|
||||
PBD::AngularVector position;
|
||||
bool visible;
|
||||
std::string text;
|
||||
|
||||
Target (const PBD::AngularVector&, const char* txt = 0);
|
||||
~Target ();
|
||||
Target (const PBD::AngularVector&, const char* txt = 0);
|
||||
~Target ();
|
||||
|
||||
void set_text (const char*);
|
||||
void set_selected (bool yn) {
|
||||
_selected = yn;
|
||||
}
|
||||
bool selected() const {
|
||||
return _selected;
|
||||
}
|
||||
void set_text (const char*);
|
||||
void set_selected (bool yn) {
|
||||
_selected = yn;
|
||||
}
|
||||
bool selected() const {
|
||||
return _selected;
|
||||
}
|
||||
|
||||
private:
|
||||
bool _selected;
|
||||
private:
|
||||
bool _selected;
|
||||
};
|
||||
|
||||
boost::shared_ptr<ARDOUR::Panner> panner;
|
||||
|
|
@ -130,10 +130,10 @@ class Panner2d : public Gtk::DrawingArea
|
|||
PBD::ScopedConnection state_connection;
|
||||
PBD::ScopedConnection change_connection;
|
||||
|
||||
/* cartesian coordinates in GTK units ; adjust to same but on a circle of radius 1.0
|
||||
and centered in the middle of our area
|
||||
*/
|
||||
void clamp_to_circle (double& x, double& y);
|
||||
/* cartesian coordinates in GTK units ; adjust to same but on a circle of radius 1.0
|
||||
and centered in the middle of our area
|
||||
*/
|
||||
void clamp_to_circle (double& x, double& y);
|
||||
};
|
||||
|
||||
class Panner2dWindow : public Gtk::Window
|
||||
|
|
@ -146,13 +146,13 @@ class Panner2dWindow : public Gtk::Window
|
|||
private:
|
||||
Panner2d widget;
|
||||
|
||||
Gtk::HBox hpacker;
|
||||
Gtk::VBox button_box;
|
||||
Gtk::Button reset_button;
|
||||
Gtk::HBox hpacker;
|
||||
Gtk::VBox button_box;
|
||||
Gtk::Button reset_button;
|
||||
Gtk::ToggleButton bypass_button;
|
||||
Gtk::ToggleButton mute_button;
|
||||
Gtk::VBox spinner_box;
|
||||
Gtk::VBox left_side;
|
||||
Gtk::VBox spinner_box;
|
||||
Gtk::VBox left_side;
|
||||
|
||||
std::vector<Gtk::SpinButton*> spinners;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ class StreamPanner : public PBD::Stateful
|
|||
void set_muted (bool yn);
|
||||
bool muted() const { return _muted; }
|
||||
|
||||
const PBD::AngularVector& get_position() const { return _angles; }
|
||||
const PBD::AngularVector& get_effective_position() const { return _effective_angles; }
|
||||
void set_position (const PBD::AngularVector&, bool link_call = false);
|
||||
void set_diffusion (double);
|
||||
const PBD::AngularVector& get_position() const { return _angles; }
|
||||
const PBD::AngularVector& get_effective_position() const { return _effective_angles; }
|
||||
void set_position (const PBD::AngularVector&, bool link_call = false);
|
||||
void set_diffusion (double);
|
||||
|
||||
void distribute (AudioBuffer &, BufferSet &, gain_t, nframes_t);
|
||||
void distribute_automated (AudioBuffer &, BufferSet &, nframes_t, nframes_t, nframes_t, pan_t **);
|
||||
|
|
@ -71,7 +71,8 @@ class StreamPanner : public PBD::Stateful
|
|||
*/
|
||||
virtual void do_distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes) = 0;
|
||||
virtual void do_distribute_automated (AudioBuffer& src, BufferSet& obufs,
|
||||
nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) = 0;
|
||||
nframes_t start, nframes_t end, nframes_t nframes,
|
||||
pan_t** buffers) = 0;
|
||||
|
||||
boost::shared_ptr<AutomationControl> pan_control() { return _control; }
|
||||
|
||||
|
|
@ -92,9 +93,9 @@ class StreamPanner : public PBD::Stateful
|
|||
|
||||
void set_mono (bool);
|
||||
|
||||
PBD::AngularVector _angles;
|
||||
PBD::AngularVector _effective_angles;
|
||||
double _diffusion;
|
||||
PBD::AngularVector _angles;
|
||||
PBD::AngularVector _effective_angles;
|
||||
double _diffusion;
|
||||
|
||||
bool _muted;
|
||||
bool _mono;
|
||||
|
|
@ -121,19 +122,18 @@ class BaseStereoPanner : public StreamPanner
|
|||
|
||||
void do_distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes);
|
||||
|
||||
static double azimuth_to_lr_fract (double azi) {
|
||||
/* 180.0 degrees=> left => 0.0 */
|
||||
/* 0.0 degrees => right => 1.0 */
|
||||
return 1.0 - (azi/180.0);
|
||||
}
|
||||
|
||||
static double lr_fract_to_azimuth (double fract) {
|
||||
/* fract = 0.0 => degrees = 180.0 => left */
|
||||
/* fract = 1.0 => degrees = 0.0 => right */
|
||||
return 180.0 - (fract * 180.0);
|
||||
}
|
||||
|
||||
static double azimuth_to_lr_fract (double azi) {
|
||||
/* 180.0 degrees=> left => 0.0 */
|
||||
/* 0.0 degrees => right => 1.0 */
|
||||
return 1.0 - (azi/180.0);
|
||||
}
|
||||
|
||||
static double lr_fract_to_azimuth (double fract) {
|
||||
/* fract = 0.0 => degrees = 180.0 => left */
|
||||
/* fract = 1.0 => degrees = 0.0 => right */
|
||||
return 180.0 - (fract * 180.0);
|
||||
}
|
||||
|
||||
/* old school automation loading */
|
||||
|
||||
int load (std::istream&, std::string path, uint32_t&);
|
||||
|
|
@ -154,7 +154,8 @@ class EqualPowerStereoPanner : public BaseStereoPanner
|
|||
~EqualPowerStereoPanner ();
|
||||
|
||||
void do_distribute_automated (AudioBuffer& src, BufferSet& obufs,
|
||||
nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers);
|
||||
nframes_t start, nframes_t end, nframes_t nframes,
|
||||
pan_t** buffers);
|
||||
|
||||
void get_current_coefficients (pan_t*) const;
|
||||
void get_desired_coefficients (pan_t*) const;
|
||||
|
|
@ -295,7 +296,7 @@ public:
|
|||
|
||||
static float current_automation_version_number;
|
||||
|
||||
void setup_speakers (uint32_t nouts);
|
||||
void setup_speakers (uint32_t nouts);
|
||||
|
||||
/* old school automation handling */
|
||||
|
||||
|
|
|
|||
|
|
@ -729,7 +729,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
|
||||
/* Speakers */
|
||||
|
||||
Speakers& get_speakers ();
|
||||
Speakers& get_speakers ();
|
||||
|
||||
/* Controllables */
|
||||
|
||||
|
|
@ -1440,7 +1440,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
static int ask_about_playlist_deletion (boost::shared_ptr<Playlist>);
|
||||
|
||||
/* realtime "apply to set of routes" operations */
|
||||
SessionEvent* get_rt_event (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override,
|
||||
SessionEvent* get_rt_event (
|
||||
boost::shared_ptr<RouteList> rl, bool yn,
|
||||
SessionEvent::RTeventCallback after, bool group_override,
|
||||
void (Session::*method) (boost::shared_ptr<RouteList>, bool, bool));
|
||||
|
||||
void rt_set_solo (boost::shared_ptr<RouteList>, bool yn, bool group_override);
|
||||
|
|
@ -1471,7 +1473,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
void start_time_changed (framepos_t);
|
||||
void end_time_changed (framepos_t);
|
||||
|
||||
Speakers* _speakers;
|
||||
Speakers* _speakers;
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
|
|
|||
|
|
@ -24,19 +24,19 @@
|
|||
namespace ARDOUR {
|
||||
|
||||
class Speaker {
|
||||
public:
|
||||
Speaker (int, const PBD::AngularVector& position);
|
||||
public:
|
||||
Speaker (int, const PBD::AngularVector& position);
|
||||
|
||||
void move (const PBD::AngularVector& new_position);
|
||||
void move (const PBD::AngularVector& new_position);
|
||||
|
||||
const PBD::CartesianVector& coords() const { return _coords; }
|
||||
const PBD::AngularVector& angles() const { return _angles; }
|
||||
const PBD::CartesianVector& coords() const { return _coords; }
|
||||
const PBD::AngularVector& angles() const { return _angles; }
|
||||
|
||||
int id;
|
||||
int id;
|
||||
|
||||
private:
|
||||
PBD::CartesianVector _coords;
|
||||
PBD::AngularVector _angles;
|
||||
private:
|
||||
PBD::CartesianVector _coords;
|
||||
PBD::AngularVector _angles;
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
|
|
|||
|
|
@ -29,25 +29,25 @@
|
|||
namespace ARDOUR {
|
||||
|
||||
class Speakers {
|
||||
public:
|
||||
Speakers ();
|
||||
virtual ~Speakers ();
|
||||
public:
|
||||
Speakers ();
|
||||
virtual ~Speakers ();
|
||||
|
||||
virtual int add_speaker (const PBD::AngularVector&);
|
||||
virtual void remove_speaker (int id);
|
||||
virtual void move_speaker (int id, const PBD::AngularVector& new_position);
|
||||
virtual void clear_speakers ();
|
||||
virtual int add_speaker (const PBD::AngularVector&);
|
||||
virtual void remove_speaker (int id);
|
||||
virtual void move_speaker (int id, const PBD::AngularVector& new_position);
|
||||
virtual void clear_speakers ();
|
||||
|
||||
std::vector<Speaker>& speakers() { return _speakers; }
|
||||
std::vector<Speaker>& speakers() { return _speakers; }
|
||||
|
||||
void dump_speakers (std::ostream&);
|
||||
void dump_speakers (std::ostream&);
|
||||
|
||||
PBD::Signal0<void> Changed;
|
||||
PBD::Signal0<void> Changed;
|
||||
|
||||
protected:
|
||||
std::vector<Speaker> _speakers;
|
||||
protected:
|
||||
std::vector<Speaker> _speakers;
|
||||
|
||||
virtual void update () {}
|
||||
virtual void update () {}
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
|
|
|||
|
|
@ -30,40 +30,40 @@ namespace ARDOUR {
|
|||
class Speakers;
|
||||
|
||||
class VBAPanner : public StreamPanner {
|
||||
public:
|
||||
VBAPanner (Panner& parent, Evoral::Parameter param, Speakers& s);
|
||||
~VBAPanner ();
|
||||
public:
|
||||
VBAPanner (Panner& parent, Evoral::Parameter param, Speakers& s);
|
||||
~VBAPanner ();
|
||||
|
||||
static StreamPanner* factory (Panner& parent, Evoral::Parameter param, Speakers& s);
|
||||
static std::string name;
|
||||
static StreamPanner* factory (Panner& parent, Evoral::Parameter param, Speakers& s);
|
||||
static std::string name;
|
||||
|
||||
void do_distribute (AudioBuffer&, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes);
|
||||
void do_distribute (AudioBuffer&, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes);
|
||||
void do_distribute_automated (AudioBuffer& src, BufferSet& obufs,
|
||||
nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers);
|
||||
nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers);
|
||||
|
||||
void set_azimuth_elevation (double azimuth, double elevation);
|
||||
void set_azimuth_elevation (double azimuth, double elevation);
|
||||
|
||||
XMLNode& state (bool full_state);
|
||||
XMLNode& get_state ();
|
||||
int set_state (const XMLNode&, int version);
|
||||
|
||||
/* there never was any old-school automation */
|
||||
/* there never was any old-school automation */
|
||||
|
||||
int load (std::istream&, std::string path, uint32_t&) { return 0; }
|
||||
|
||||
private:
|
||||
bool _dirty;
|
||||
double gains[3];
|
||||
double desired_gains[3];
|
||||
int outputs[3];
|
||||
int desired_outputs[3];
|
||||
private:
|
||||
bool _dirty;
|
||||
double gains[3];
|
||||
double desired_gains[3];
|
||||
int outputs[3];
|
||||
int desired_outputs[3];
|
||||
|
||||
VBAPSpeakers& _speakers;
|
||||
VBAPSpeakers& _speakers;
|
||||
|
||||
void compute_gains (double g[3], int ls[3], int azi, int ele);
|
||||
void compute_gains (double g[3], int ls[3], int azi, int ele);
|
||||
|
||||
void update ();
|
||||
void mark_dirty ();
|
||||
void update ();
|
||||
void mark_dirty ();
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
|
|
|||
|
|
@ -34,71 +34,71 @@ namespace ARDOUR {
|
|||
class Speakers;
|
||||
|
||||
class VBAPSpeakers : public boost::noncopyable {
|
||||
public:
|
||||
typedef std::vector<double> dvector;
|
||||
public:
|
||||
typedef std::vector<double> dvector;
|
||||
|
||||
const dvector matrix (int tuple) const { return _matrices[tuple]; }
|
||||
int speaker_for_tuple (int tuple, int which) const { return _speaker_tuples[tuple][which]; }
|
||||
const dvector matrix (int tuple) const { return _matrices[tuple]; }
|
||||
int speaker_for_tuple (int tuple, int which) const { return _speaker_tuples[tuple][which]; }
|
||||
|
||||
int n_tuples () const { return _matrices.size(); }
|
||||
int dimension() const { return _dimension; }
|
||||
int n_tuples () const { return _matrices.size(); }
|
||||
int dimension() const { return _dimension; }
|
||||
|
||||
static VBAPSpeakers& instance (Speakers&);
|
||||
static VBAPSpeakers& instance (Speakers&);
|
||||
|
||||
~VBAPSpeakers ();
|
||||
~VBAPSpeakers ();
|
||||
|
||||
private:
|
||||
static VBAPSpeakers* _instance;
|
||||
static const double MIN_VOL_P_SIDE_LGTH = 0.01;
|
||||
int _dimension;
|
||||
std::vector<Speaker>& _speakers;
|
||||
PBD::ScopedConnection speaker_connection;
|
||||
private:
|
||||
static VBAPSpeakers* _instance;
|
||||
static const double MIN_VOL_P_SIDE_LGTH = 0.01;
|
||||
int _dimension;
|
||||
std::vector<Speaker>& _speakers;
|
||||
PBD::ScopedConnection speaker_connection;
|
||||
|
||||
VBAPSpeakers (Speakers&);
|
||||
VBAPSpeakers (Speakers&);
|
||||
|
||||
struct azimuth_sorter {
|
||||
bool operator() (const Speaker& s1, const Speaker& s2) {
|
||||
return s1.angles().azi < s2.angles().azi;
|
||||
}
|
||||
};
|
||||
struct azimuth_sorter {
|
||||
bool operator() (const Speaker& s1, const Speaker& s2) {
|
||||
return s1.angles().azi < s2.angles().azi;
|
||||
}
|
||||
};
|
||||
|
||||
struct twoDmatrix : public dvector {
|
||||
twoDmatrix() : dvector (4, 0.0) {}
|
||||
};
|
||||
struct twoDmatrix : public dvector {
|
||||
twoDmatrix() : dvector (4, 0.0) {}
|
||||
};
|
||||
|
||||
struct threeDmatrix : public dvector {
|
||||
threeDmatrix() : dvector (9, 0.0) {}
|
||||
};
|
||||
struct threeDmatrix : public dvector {
|
||||
threeDmatrix() : dvector (9, 0.0) {}
|
||||
};
|
||||
|
||||
struct tmatrix : public dvector {
|
||||
tmatrix() : dvector (3, 0.0) {}
|
||||
};
|
||||
struct tmatrix : public dvector {
|
||||
tmatrix() : dvector (3, 0.0) {}
|
||||
};
|
||||
|
||||
std::vector<dvector> _matrices; /* holds matrices for a given speaker combinations */
|
||||
std::vector<tmatrix> _speaker_tuples; /* holds speakers IDs for a given combination */
|
||||
std::vector<dvector> _matrices; /* holds matrices for a given speaker combinations */
|
||||
std::vector<tmatrix> _speaker_tuples; /* holds speakers IDs for a given combination */
|
||||
|
||||
/* A struct for all loudspeakers */
|
||||
struct ls_triplet_chain {
|
||||
int ls_nos[3];
|
||||
float inv_mx[9];
|
||||
struct ls_triplet_chain *next;
|
||||
};
|
||||
/* A struct for all loudspeakers */
|
||||
struct ls_triplet_chain {
|
||||
int ls_nos[3];
|
||||
float inv_mx[9];
|
||||
struct ls_triplet_chain *next;
|
||||
};
|
||||
|
||||
static float vec_angle(PBD::CartesianVector v1, PBD::CartesianVector v2);
|
||||
static float vec_length(PBD::CartesianVector v1);
|
||||
static float vec_prod(PBD::CartesianVector v1, PBD::CartesianVector v2);
|
||||
static float vol_p_side_lgth(int i, int j,int k, const std::vector<Speaker>&);
|
||||
static void cross_prod(PBD::CartesianVector v1,PBD::CartesianVector v2, PBD::CartesianVector *res);
|
||||
static float vec_angle(PBD::CartesianVector v1, PBD::CartesianVector v2);
|
||||
static float vec_length(PBD::CartesianVector v1);
|
||||
static float vec_prod(PBD::CartesianVector v1, PBD::CartesianVector v2);
|
||||
static float vol_p_side_lgth(int i, int j,int k, const std::vector<Speaker>&);
|
||||
static void cross_prod(PBD::CartesianVector v1,PBD::CartesianVector v2, PBD::CartesianVector *res);
|
||||
|
||||
void update ();
|
||||
int any_ls_inside_triplet (int a, int b, int c);
|
||||
void add_ldsp_triplet (int i, int j, int k, struct ls_triplet_chain **ls_triplets);
|
||||
int lines_intersect (int i,int j,int k,int l);
|
||||
void calculate_3x3_matrixes (struct ls_triplet_chain *ls_triplets);
|
||||
void choose_speaker_triplets (struct ls_triplet_chain **ls_triplets);
|
||||
void choose_speaker_pairs ();
|
||||
void sort_2D_lss (int* sorted_lss);
|
||||
int calc_2D_inv_tmatrix (double azi1,double azi2, double* inv_mat);
|
||||
void update ();
|
||||
int any_ls_inside_triplet (int a, int b, int c);
|
||||
void add_ldsp_triplet (int i, int j, int k, struct ls_triplet_chain **ls_triplets);
|
||||
int lines_intersect (int i,int j,int k,int l);
|
||||
void calculate_3x3_matrixes (struct ls_triplet_chain *ls_triplets);
|
||||
void choose_speaker_triplets (struct ls_triplet_chain **ls_triplets);
|
||||
void choose_speaker_pairs ();
|
||||
void sort_2D_lss (int* sorted_lss);
|
||||
int calc_2D_inv_tmatrix (double azi1,double azi2, double* inv_mat);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/*
|
||||
Copyright (C) 2004 Paul Davis
|
||||
|
||||
|
|
@ -125,8 +126,8 @@ StreamPanner::set_position (const AngularVector& av, bool link_call)
|
|||
parent.set_position (av, *this);
|
||||
}
|
||||
|
||||
if (_angles != av) {
|
||||
_angles = av;
|
||||
if (_angles != av) {
|
||||
_angles = av;
|
||||
update ();
|
||||
Changed ();
|
||||
_control->Changed ();
|
||||
|
|
@ -397,7 +398,7 @@ EqualPowerStereoPanner::update ()
|
|||
x == 1 => hard right = 0.0 degrees
|
||||
*/
|
||||
|
||||
double _x = BaseStereoPanner::azimuth_to_lr_fract (_angles.azi);
|
||||
double _x = BaseStereoPanner::azimuth_to_lr_fract (_angles.azi);
|
||||
|
||||
float const panR = _x;
|
||||
float const panL = 1 - panR;
|
||||
|
|
@ -502,7 +503,7 @@ EqualPowerStereoPanner::state (bool /*full_state*/)
|
|||
LocaleGuard lg (X_("POSIX"));
|
||||
|
||||
snprintf (buf, sizeof (buf), "%.12g", _angles.azi);
|
||||
root->add_property (X_("azimuth"), buf);
|
||||
root->add_property (X_("azimuth"), buf);
|
||||
root->add_property (X_("type"), EqualPowerStereoPanner::name);
|
||||
|
||||
// XXX: dont save automation here... its part of the automatable panner now.
|
||||
|
|
@ -522,13 +523,13 @@ EqualPowerStereoPanner::set_state (const XMLNode& node, int version)
|
|||
|
||||
if ((prop = node.property (X_("azimuth")))) {
|
||||
AngularVector a (atof (prop->value().c_str()), 0.0);
|
||||
set_position (a, true);
|
||||
} else if ((prop = node.property (X_("x")))) {
|
||||
/* old school cartesian positioning */
|
||||
AngularVector a;
|
||||
a.azi = BaseStereoPanner::lr_fract_to_azimuth (atof (prop->value().c_str()));
|
||||
set_position (a, true);
|
||||
}
|
||||
set_position (a, true);
|
||||
} else if ((prop = node.property (X_("x")))) {
|
||||
/* old school cartesian positioning */
|
||||
AngularVector a;
|
||||
a.azi = BaseStereoPanner::lr_fract_to_azimuth (atof (prop->value().c_str()));
|
||||
set_position (a, true);
|
||||
}
|
||||
|
||||
StreamPanner::set_state (node, version);
|
||||
|
||||
|
|
@ -544,7 +545,7 @@ EqualPowerStereoPanner::set_state (const XMLNode& node, int version)
|
|||
_control->alist()->set_state (*((*iter)->children().front()), version);
|
||||
|
||||
if (_control->alist()->automation_state() != Off) {
|
||||
double degrees = BaseStereoPanner::lr_fract_to_azimuth (_control->list()->eval (parent.session().transport_frame()));
|
||||
double degrees = BaseStereoPanner::lr_fract_to_azimuth (_control->list()->eval (parent.session().transport_frame()));
|
||||
set_position (AngularVector (degrees, 0.0));
|
||||
}
|
||||
}
|
||||
|
|
@ -613,19 +614,19 @@ Panner::reset_to_default ()
|
|||
}
|
||||
|
||||
if (outputs.size() == 2) {
|
||||
AngularVector a;
|
||||
AngularVector a;
|
||||
switch (_streampanners.size()) {
|
||||
case 1:
|
||||
a.azi = 90.0; /* "front" or "top", in degrees */
|
||||
a.azi = 90.0; /* "front" or "top", in degrees */
|
||||
_streampanners.front()->set_position (a);
|
||||
_streampanners.front()->pan_control()->list()->reset_default (0.5);
|
||||
return;
|
||||
break;
|
||||
case 2:
|
||||
a.azi = 180.0; /* "left", in degrees */
|
||||
a.azi = 180.0; /* "left", in degrees */
|
||||
_streampanners.front()->set_position (a);
|
||||
_streampanners.front()->pan_control()->list()->reset_default (0.0);
|
||||
a.azi = 0.0; /* "right", in degrees */
|
||||
a.azi = 0.0; /* "right", in degrees */
|
||||
_streampanners.back()->set_position (a);
|
||||
_streampanners.back()->pan_control()->list()->reset_default (1.0);
|
||||
return;
|
||||
|
|
@ -645,7 +646,7 @@ Panner::reset_to_default ()
|
|||
void
|
||||
Panner::reset_streampanner (uint32_t which)
|
||||
{
|
||||
AngularVector a;
|
||||
AngularVector a;
|
||||
|
||||
if (which >= _streampanners.size() || which >= outputs.size()) {
|
||||
return;
|
||||
|
|
@ -660,20 +661,20 @@ Panner::reset_streampanner (uint32_t which)
|
|||
switch (_streampanners.size()) {
|
||||
case 1:
|
||||
/* stereo out, 1 stream, default = middle */
|
||||
a.azi = 90.0; /* "front" or "top", in degrees */
|
||||
a.azi = 90.0; /* "front" or "top", in degrees */
|
||||
_streampanners.front()->set_position (a);
|
||||
_streampanners.front()->pan_control()->list()->reset_default (0.5);
|
||||
break;
|
||||
case 2:
|
||||
/* stereo out, 2 streams, default = hard left/right */
|
||||
if (which == 0) {
|
||||
a.azi = 180.0; /* "left", in degrees */
|
||||
_streampanners.front()->set_position (a);
|
||||
_streampanners.front()->pan_control()->list()->reset_default (0.0);
|
||||
} else {
|
||||
a.azi = 0.0; /* "right", in degrees */
|
||||
_streampanners.back()->set_position (a);
|
||||
_streampanners.back()->pan_control()->list()->reset_default (1.0);
|
||||
a.azi = 180.0; /* "left", in degrees */
|
||||
_streampanners.front()->set_position (a);
|
||||
_streampanners.front()->pan_control()->list()->reset_default (0.0);
|
||||
} else {
|
||||
a.azi = 0.0; /* "right", in degrees */
|
||||
_streampanners.back()->set_position (a);
|
||||
_streampanners.back()->pan_control()->list()->reset_default (1.0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -747,10 +748,10 @@ Panner::reset (uint32_t nouts, uint32_t npans)
|
|||
for (n = 0; n < npans; ++n) {
|
||||
_streampanners.push_back (new EqualPowerStereoPanner (*this, Evoral::Parameter(PanAutomation, 0, n)));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
setup_speakers (nouts);
|
||||
default:
|
||||
setup_speakers (nouts);
|
||||
for (n = 0; n < npans; ++n) {
|
||||
_streampanners.push_back (new VBAPanner (*this, Evoral::Parameter(PanAutomation, 0, n), _session.get_speakers()));
|
||||
}
|
||||
|
|
@ -784,7 +785,7 @@ Panner::reset (uint32_t nouts, uint32_t npans)
|
|||
left = _streampanners.front()->get_position ();
|
||||
right = _streampanners.back()->get_position ();
|
||||
|
||||
if (changed || ((left.azi == 0.0) && (right.azi == 0.0))) {
|
||||
if (changed || ((left.azi == 0.0) && (right.azi == 0.0))) {
|
||||
|
||||
_streampanners.front()->set_position (AngularVector (180.0, 0.0));
|
||||
_streampanners.front()->pan_control()->list()->reset_default (0.0);
|
||||
|
|
@ -795,26 +796,26 @@ Panner::reset (uint32_t nouts, uint32_t npans)
|
|||
|
||||
} else if (npans > 1 && outputs.size() > 2) {
|
||||
|
||||
/* 2d panning: spread signals equally around a circle */
|
||||
/* 2d panning: spread signals equally around a circle */
|
||||
|
||||
double degree_step = 360.0 / nouts;
|
||||
double deg;
|
||||
double degree_step = 360.0 / nouts;
|
||||
double deg;
|
||||
|
||||
/* even number of signals? make sure the top two are either side of "top".
|
||||
otherwise, just start at the "top" (90.0 degrees) and rotate around
|
||||
*/
|
||||
/* even number of signals? make sure the top two are either side of "top".
|
||||
otherwise, just start at the "top" (90.0 degrees) and rotate around
|
||||
*/
|
||||
|
||||
if (npans % 2) {
|
||||
deg = 90.0 - degree_step;
|
||||
} else {
|
||||
deg = 90.0;
|
||||
}
|
||||
if (npans % 2) {
|
||||
deg = 90.0 - degree_step;
|
||||
} else {
|
||||
deg = 90.0;
|
||||
}
|
||||
|
||||
for (std::vector<StreamPanner*>::iterator x = _streampanners.begin(); x != _streampanners.end(); ++x) {
|
||||
(*x)->set_position (AngularVector (deg, 0.0));
|
||||
deg += degree_step;
|
||||
}
|
||||
}
|
||||
for (std::vector<StreamPanner*>::iterator x = _streampanners.begin(); x != _streampanners.end(); ++x) {
|
||||
(*x)->set_position (AngularVector (deg, 0.0));
|
||||
deg += degree_step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -971,18 +972,18 @@ Panner::set_state (const XMLNode& node, int version)
|
|||
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
||||
if ((*niter)->name() == X_("Output")) {
|
||||
|
||||
AngularVector a;
|
||||
AngularVector a;
|
||||
|
||||
if ((prop = (*niter)->property (X_("azimuth")))) {
|
||||
sscanf (prop->value().c_str(), "%lg", &a.azi);
|
||||
} else if ((prop = (*niter)->property (X_("x")))) {
|
||||
/* old school cartesian */
|
||||
a.azi = BaseStereoPanner::lr_fract_to_azimuth (atof (prop->value().c_str()));
|
||||
}
|
||||
sscanf (prop->value().c_str(), "%lg", &a.azi);
|
||||
} else if ((prop = (*niter)->property (X_("x")))) {
|
||||
/* old school cartesian */
|
||||
a.azi = BaseStereoPanner::lr_fract_to_azimuth (atof (prop->value().c_str()));
|
||||
}
|
||||
|
||||
if ((prop = (*niter)->property (X_("elevation")))) {
|
||||
sscanf (prop->value().c_str(), "%lg", &a.ele);
|
||||
}
|
||||
sscanf (prop->value().c_str(), "%lg", &a.ele);
|
||||
}
|
||||
|
||||
outputs.push_back (Output (a));
|
||||
}
|
||||
|
|
@ -1064,10 +1065,10 @@ Panner::touching () const
|
|||
void
|
||||
Panner::set_position (const AngularVector& a, StreamPanner& orig)
|
||||
{
|
||||
AngularVector delta;
|
||||
AngularVector new_position;
|
||||
AngularVector delta;
|
||||
AngularVector new_position;
|
||||
|
||||
delta = orig.get_position() - a;
|
||||
delta = orig.get_position() - a;
|
||||
|
||||
if (_link_direction == SameDirection) {
|
||||
|
||||
|
|
@ -1075,7 +1076,7 @@ Panner::set_position (const AngularVector& a, StreamPanner& orig)
|
|||
if (*i == &orig) {
|
||||
(*i)->set_position (a, true);
|
||||
} else {
|
||||
new_position = (*i)->get_position() + delta;
|
||||
new_position = (*i)->get_position() + delta;
|
||||
(*i)->set_position (new_position, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1086,7 +1087,7 @@ Panner::set_position (const AngularVector& a, StreamPanner& orig)
|
|||
if (*i == &orig) {
|
||||
(*i)->set_position (a, true);
|
||||
} else {
|
||||
new_position = (*i)->get_position() - delta;
|
||||
new_position = (*i)->get_position() - delta;
|
||||
(*i)->set_position (new_position, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1343,47 +1344,47 @@ Panner::value_as_string (double v)
|
|||
void
|
||||
Panner::setup_speakers (uint32_t nouts)
|
||||
{
|
||||
switch (nouts) {
|
||||
case 3:
|
||||
/* top, bottom kind-of-left & bottom kind-of-right */
|
||||
outputs.push_back (AngularVector (90.0, 0.0));
|
||||
outputs.push_back (AngularVector (215.0, 0,0));
|
||||
outputs.push_back (AngularVector (335.0, 0,0));
|
||||
break;
|
||||
case 4:
|
||||
/* clockwise from top left */
|
||||
outputs.push_back (AngularVector (135.0, 0.0));
|
||||
outputs.push_back (AngularVector (45.0, 0.0));
|
||||
outputs.push_back (AngularVector (335.0, 0.0));
|
||||
outputs.push_back (AngularVector (215.0, 0.0));
|
||||
break;
|
||||
switch (nouts) {
|
||||
case 3:
|
||||
/* top, bottom kind-of-left & bottom kind-of-right */
|
||||
outputs.push_back (AngularVector (90.0, 0.0));
|
||||
outputs.push_back (AngularVector (215.0, 0,0));
|
||||
outputs.push_back (AngularVector (335.0, 0,0));
|
||||
break;
|
||||
case 4:
|
||||
/* clockwise from top left */
|
||||
outputs.push_back (AngularVector (135.0, 0.0));
|
||||
outputs.push_back (AngularVector (45.0, 0.0));
|
||||
outputs.push_back (AngularVector (335.0, 0.0));
|
||||
outputs.push_back (AngularVector (215.0, 0.0));
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
double degree_step = 360.0 / nouts;
|
||||
double deg;
|
||||
uint32_t n;
|
||||
{
|
||||
double degree_step = 360.0 / nouts;
|
||||
double deg;
|
||||
uint32_t n;
|
||||
|
||||
/* even number of speakers? make sure the top two are either side of "top".
|
||||
otherwise, just start at the "top" (90.0 degrees) and rotate around
|
||||
*/
|
||||
/* even number of speakers? make sure the top two are either side of "top".
|
||||
otherwise, just start at the "top" (90.0 degrees) and rotate around
|
||||
*/
|
||||
|
||||
if (nouts % 2) {
|
||||
deg = 90.0 - degree_step;
|
||||
} else {
|
||||
deg = 90.0;
|
||||
}
|
||||
if (nouts % 2) {
|
||||
deg = 90.0 - degree_step;
|
||||
} else {
|
||||
deg = 90.0;
|
||||
}
|
||||
for (n = 0; n < nouts; ++n, deg += degree_step) {
|
||||
outputs.push_back (Output (AngularVector (deg, 0.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Speakers& speakers (_session.get_speakers());
|
||||
Speakers& speakers (_session.get_speakers());
|
||||
|
||||
speakers.clear_speakers ();
|
||||
speakers.clear_speakers ();
|
||||
|
||||
for (vector<Output>::iterator o = outputs.begin(); o != outputs.end(); ++o) {
|
||||
speakers.add_speaker ((*o).position);
|
||||
}
|
||||
for (vector<Output>::iterator o = outputs.begin(); o != outputs.end(); ++o) {
|
||||
speakers.add_speaker ((*o).position);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -24,16 +24,16 @@ using namespace PBD;
|
|||
using namespace std;
|
||||
|
||||
Speaker::Speaker (int i, const AngularVector& position)
|
||||
: id (i)
|
||||
: id (i)
|
||||
{
|
||||
move (position);
|
||||
move (position);
|
||||
}
|
||||
|
||||
void
|
||||
Speaker::move (const AngularVector& new_position)
|
||||
{
|
||||
_angles = new_position;
|
||||
_angles.cartesian (_coords);
|
||||
_angles = new_position;
|
||||
_angles.cartesian (_coords);
|
||||
}
|
||||
|
||||
Speakers::Speakers ()
|
||||
|
|
@ -47,62 +47,59 @@ Speakers::~Speakers ()
|
|||
void
|
||||
Speakers::dump_speakers (ostream& o)
|
||||
{
|
||||
for (vector<Speaker>::iterator i = _speakers.begin(); i != _speakers.end(); ++i) {
|
||||
o << "Speaker " << (*i).id << " @ "
|
||||
<< (*i).coords().x << ", " << (*i).coords().y << ", " << (*i).coords().z
|
||||
<< " azimuth " << (*i).angles().azi
|
||||
<< " elevation " << (*i).angles().ele
|
||||
<< " distance " << (*i).angles().length
|
||||
<< endl;
|
||||
}
|
||||
for (vector<Speaker>::iterator i = _speakers.begin(); i != _speakers.end(); ++i) {
|
||||
o << "Speaker " << (*i).id << " @ "
|
||||
<< (*i).coords().x << ", " << (*i).coords().y << ", " << (*i).coords().z
|
||||
<< " azimuth " << (*i).angles().azi
|
||||
<< " elevation " << (*i).angles().ele
|
||||
<< " distance " << (*i).angles().length
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Speakers::clear_speakers ()
|
||||
{
|
||||
_speakers.clear ();
|
||||
update ();
|
||||
_speakers.clear ();
|
||||
update ();
|
||||
}
|
||||
|
||||
int
|
||||
Speakers::add_speaker (const AngularVector& position)
|
||||
{
|
||||
int id = _speakers.size();
|
||||
int id = _speakers.size();
|
||||
|
||||
cerr << "Added speaker " << id << " at " << position.azi << " /= " << position.ele << endl;
|
||||
cerr << "Added speaker " << id << " at " << position.azi << " /= " << position.ele << endl;
|
||||
|
||||
_speakers.push_back (Speaker (id, position));
|
||||
update ();
|
||||
_speakers.push_back (Speaker (id, position));
|
||||
update ();
|
||||
|
||||
dump_speakers (cerr);
|
||||
Changed ();
|
||||
dump_speakers (cerr);
|
||||
Changed ();
|
||||
|
||||
return id;
|
||||
return id;
|
||||
}
|
||||
|
||||
void
|
||||
Speakers::remove_speaker (int id)
|
||||
{
|
||||
for (vector<Speaker>::iterator i = _speakers.begin(); i != _speakers.end(); ) {
|
||||
if ((*i).id == id) {
|
||||
i = _speakers.erase (i);
|
||||
update ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (vector<Speaker>::iterator i = _speakers.begin(); i != _speakers.end(); ) {
|
||||
if ((*i).id == id) {
|
||||
i = _speakers.erase (i);
|
||||
update ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Speakers::move_speaker (int id, const AngularVector& new_position)
|
||||
{
|
||||
for (vector<Speaker>::iterator i = _speakers.begin(); i != _speakers.end(); ++i) {
|
||||
if ((*i).id == id) {
|
||||
(*i).move (new_position);
|
||||
update ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (vector<Speaker>::iterator i = _speakers.begin(); i != _speakers.end(); ++i) {
|
||||
if ((*i).id == id) {
|
||||
(*i).move (new_position);
|
||||
update ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/*
|
||||
This software is being provided to you, the licensee, by Ville Pulkki,
|
||||
under the following license. By obtaining, using and/or copying this
|
||||
|
|
@ -54,9 +55,9 @@ using namespace std;
|
|||
string VBAPanner::name = X_("VBAP");
|
||||
|
||||
VBAPanner::VBAPanner (Panner& parent, Evoral::Parameter param, Speakers& s)
|
||||
: StreamPanner (parent, param)
|
||||
, _dirty (false)
|
||||
, _speakers (VBAPSpeakers::instance (s))
|
||||
: StreamPanner (parent, param)
|
||||
, _dirty (false)
|
||||
, _speakers (VBAPSpeakers::instance (s))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -67,76 +68,76 @@ VBAPanner::~VBAPanner ()
|
|||
void
|
||||
VBAPanner::mark_dirty ()
|
||||
{
|
||||
_dirty = true;
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
void
|
||||
VBAPanner::update ()
|
||||
{
|
||||
/* force 2D for now */
|
||||
_angles.ele = 0.0;
|
||||
_dirty = true;
|
||||
/* force 2D for now */
|
||||
_angles.ele = 0.0;
|
||||
_dirty = true;
|
||||
|
||||
Changed ();
|
||||
Changed ();
|
||||
}
|
||||
|
||||
void
|
||||
VBAPanner::compute_gains (double gains[3], int speaker_ids[3], int azi, int ele)
|
||||
{
|
||||
/* calculates gain factors using loudspeaker setup and given direction */
|
||||
double cartdir[3];
|
||||
double power;
|
||||
int i,j,k;
|
||||
double small_g;
|
||||
double big_sm_g, gtmp[3];
|
||||
/* calculates gain factors using loudspeaker setup and given direction */
|
||||
double cartdir[3];
|
||||
double power;
|
||||
int i,j,k;
|
||||
double small_g;
|
||||
double big_sm_g, gtmp[3];
|
||||
|
||||
azi_ele_to_cart (azi,ele, cartdir[0], cartdir[1], cartdir[2]);
|
||||
big_sm_g = -100000.0;
|
||||
azi_ele_to_cart (azi,ele, cartdir[0], cartdir[1], cartdir[2]);
|
||||
big_sm_g = -100000.0;
|
||||
|
||||
for (i = 0; i < _speakers.n_tuples(); i++) {
|
||||
for (i = 0; i < _speakers.n_tuples(); i++) {
|
||||
|
||||
small_g = 10000000.0;
|
||||
small_g = 10000000.0;
|
||||
|
||||
for (j = 0; j < _speakers.dimension(); j++) {
|
||||
for (j = 0; j < _speakers.dimension(); j++) {
|
||||
|
||||
gtmp[j]=0.0;
|
||||
gtmp[j]=0.0;
|
||||
|
||||
for (k = 0; k < _speakers.dimension(); k++) {
|
||||
gtmp[j] += cartdir[k] * _speakers.matrix(i)[j*_speakers.dimension()+k];
|
||||
}
|
||||
for (k = 0; k < _speakers.dimension(); k++) {
|
||||
gtmp[j] += cartdir[k] * _speakers.matrix(i)[j*_speakers.dimension()+k];
|
||||
}
|
||||
|
||||
if (gtmp[j] < small_g) {
|
||||
small_g = gtmp[j];
|
||||
}
|
||||
}
|
||||
if (gtmp[j] < small_g) {
|
||||
small_g = gtmp[j];
|
||||
}
|
||||
}
|
||||
|
||||
if (small_g > big_sm_g) {
|
||||
if (small_g > big_sm_g) {
|
||||
|
||||
big_sm_g = small_g;
|
||||
big_sm_g = small_g;
|
||||
|
||||
gains[0] = gtmp[0];
|
||||
gains[1] = gtmp[1];
|
||||
gains[0] = gtmp[0];
|
||||
gains[1] = gtmp[1];
|
||||
|
||||
speaker_ids[0] = _speakers.speaker_for_tuple (i, 0);
|
||||
speaker_ids[1] = _speakers.speaker_for_tuple (i, 1);
|
||||
speaker_ids[0] = _speakers.speaker_for_tuple (i, 0);
|
||||
speaker_ids[1] = _speakers.speaker_for_tuple (i, 1);
|
||||
|
||||
if (_speakers.dimension() == 3) {
|
||||
gains[2] = gtmp[2];
|
||||
speaker_ids[2] = _speakers.speaker_for_tuple (i, 2);
|
||||
} else {
|
||||
gains[2] = 0.0;
|
||||
speaker_ids[2] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_speakers.dimension() == 3) {
|
||||
gains[2] = gtmp[2];
|
||||
speaker_ids[2] = _speakers.speaker_for_tuple (i, 2);
|
||||
} else {
|
||||
gains[2] = 0.0;
|
||||
speaker_ids[2] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
power = sqrt (gains[0]*gains[0] + gains[1]*gains[1] + gains[2]*gains[2]);
|
||||
power = sqrt (gains[0]*gains[0] + gains[1]*gains[1] + gains[2]*gains[2]);
|
||||
|
||||
gains[0] /= power;
|
||||
gains[1] /= power;
|
||||
gains[2] /= power;
|
||||
gains[0] /= power;
|
||||
gains[1] /= power;
|
||||
gains[2] /= power;
|
||||
|
||||
_dirty = false;
|
||||
_dirty = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -148,62 +149,62 @@ VBAPanner::do_distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_coe
|
|||
|
||||
Sample* const src = srcbuf.data();
|
||||
Sample* dst;
|
||||
pan_t pan;
|
||||
uint32_t n_audio = obufs.count().n_audio();
|
||||
bool was_dirty;
|
||||
pan_t pan;
|
||||
uint32_t n_audio = obufs.count().n_audio();
|
||||
bool was_dirty;
|
||||
|
||||
if ((was_dirty = _dirty)) {
|
||||
compute_gains (desired_gains, desired_outputs, _angles.azi, _angles.ele);
|
||||
cerr << " @ " << _angles.azi << " /= " << _angles.ele
|
||||
<< " Outputs: "
|
||||
<< desired_outputs[0] + 1 << ' '
|
||||
<< desired_outputs[1] + 1 << ' '
|
||||
<< " Gains "
|
||||
<< desired_gains[0] << ' '
|
||||
<< desired_gains[1] << ' '
|
||||
<< endl;
|
||||
}
|
||||
if ((was_dirty = _dirty)) {
|
||||
compute_gains (desired_gains, desired_outputs, _angles.azi, _angles.ele);
|
||||
cerr << " @ " << _angles.azi << " /= " << _angles.ele
|
||||
<< " Outputs: "
|
||||
<< desired_outputs[0] + 1 << ' '
|
||||
<< desired_outputs[1] + 1 << ' '
|
||||
<< " Gains "
|
||||
<< desired_gains[0] << ' '
|
||||
<< desired_gains[1] << ' '
|
||||
<< endl;
|
||||
}
|
||||
|
||||
bool todo[n_audio];
|
||||
bool todo[n_audio];
|
||||
|
||||
for (uint32_t o = 0; o < n_audio; ++o) {
|
||||
todo[o] = true;
|
||||
}
|
||||
for (uint32_t o = 0; o < n_audio; ++o) {
|
||||
todo[o] = true;
|
||||
}
|
||||
|
||||
|
||||
/* VBAP may distribute the signal across up to 3 speakers depending on
|
||||
the configuration of the speakers.
|
||||
*/
|
||||
/* VBAP may distribute the signal across up to 3 speakers depending on
|
||||
the configuration of the speakers.
|
||||
*/
|
||||
|
||||
for (int o = 0; o < 3; ++o) {
|
||||
if (desired_outputs[o] != -1) {
|
||||
for (int o = 0; o < 3; ++o) {
|
||||
if (desired_outputs[o] != -1) {
|
||||
|
||||
nframes_t n = 0;
|
||||
nframes_t n = 0;
|
||||
|
||||
/* XXX TODO: interpolate across changes in gain and/or outputs
|
||||
*/
|
||||
/* XXX TODO: interpolate across changes in gain and/or outputs
|
||||
*/
|
||||
|
||||
dst = obufs.get_audio(desired_outputs[o]).data();
|
||||
dst = obufs.get_audio(desired_outputs[o]).data();
|
||||
|
||||
pan = gain_coefficient * desired_gains[o];
|
||||
mix_buffers_with_gain (dst+n,src+n,nframes-n,pan);
|
||||
pan = gain_coefficient * desired_gains[o];
|
||||
mix_buffers_with_gain (dst+n,src+n,nframes-n,pan);
|
||||
|
||||
todo[o] = false;
|
||||
}
|
||||
}
|
||||
todo[o] = false;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t o = 0; o < n_audio; ++o) {
|
||||
if (todo[o]) {
|
||||
/* VBAP decided not to deliver any audio to this output, so we write silence */
|
||||
dst = obufs.get_audio(o).data();
|
||||
memset (dst, 0, sizeof (Sample) * nframes);
|
||||
}
|
||||
}
|
||||
for (uint32_t o = 0; o < n_audio; ++o) {
|
||||
if (todo[o]) {
|
||||
/* VBAP decided not to deliver any audio to this output, so we write silence */
|
||||
dst = obufs.get_audio(o).data();
|
||||
memset (dst, 0, sizeof (Sample) * nframes);
|
||||
}
|
||||
}
|
||||
|
||||
if (was_dirty) {
|
||||
memcpy (gains, desired_gains, sizeof (gains));
|
||||
memcpy (outputs, desired_outputs, sizeof (outputs));
|
||||
}
|
||||
if (was_dirty) {
|
||||
memcpy (gains, desired_gains, sizeof (gains));
|
||||
memcpy (outputs, desired_outputs, sizeof (outputs));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -215,20 +216,20 @@ VBAPanner::do_distribute_automated (AudioBuffer& src, BufferSet& obufs,
|
|||
XMLNode&
|
||||
VBAPanner::get_state ()
|
||||
{
|
||||
return state (true);
|
||||
return state (true);
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
VBAPanner::state (bool full_state)
|
||||
{
|
||||
XMLNode* node = new XMLNode (X_("VBAPanner"));
|
||||
return *node;
|
||||
XMLNode* node = new XMLNode (X_("VBAPanner"));
|
||||
return *node;
|
||||
}
|
||||
|
||||
int
|
||||
VBAPanner::set_state (const XMLNode& node, int /*version*/)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
StreamPanner*
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -308,7 +308,7 @@ def build(bld):
|
|||
# alltogether.
|
||||
#
|
||||
if bld.env['HAVE_SLV2']:
|
||||
obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc', 'uri_map.cc' ]
|
||||
obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc', 'uri_map.cc', 'lv2_persist_file.c' ]
|
||||
obj.uselib += ' SLV2 '
|
||||
|
||||
if bld.env['VST_SUPPORT']:
|
||||
|
|
|
|||
|
|
@ -26,56 +26,56 @@ using namespace std;
|
|||
void
|
||||
PBD::azi_ele_to_cart (double azi, double ele, double& x, double& y, double& z)
|
||||
{
|
||||
/* convert from cylindrical coordinates in degrees to cartesian */
|
||||
/* convert from cylindrical coordinates in degrees to cartesian */
|
||||
|
||||
static const double atorad = 2.0 * M_PI / 360.0 ;
|
||||
static const double atorad = 2.0 * M_PI / 360.0 ;
|
||||
|
||||
x = cos (azi * atorad) * cos (ele * atorad);
|
||||
y = sin (azi * atorad) * cos (ele * atorad);
|
||||
z = sin (ele * atorad);
|
||||
x = cos (azi * atorad) * cos (ele * atorad);
|
||||
y = sin (azi * atorad) * cos (ele * atorad);
|
||||
z = sin (ele * atorad);
|
||||
}
|
||||
|
||||
void
|
||||
PBD::cart_to_azi_ele (double x, double y, double z, double& azimuth, double& elevation)
|
||||
{
|
||||
/* converts cartesian coordinates to cylindrical in degrees*/
|
||||
/* converts cartesian coordinates to cylindrical in degrees*/
|
||||
|
||||
const double atorad = 2.0 * M_PI / 360.0;
|
||||
double atan_y_per_x, atan_x_pl_y_per_z;
|
||||
double distance;
|
||||
const double atorad = 2.0 * M_PI / 360.0;
|
||||
double atan_y_per_x, atan_x_pl_y_per_z;
|
||||
double distance;
|
||||
|
||||
if(x == 0.0) {
|
||||
atan_y_per_x = M_PI / 2;
|
||||
} else {
|
||||
atan_y_per_x = atan2 (y,x);
|
||||
}
|
||||
if (x == 0.0) {
|
||||
atan_y_per_x = M_PI / 2;
|
||||
} else {
|
||||
atan_y_per_x = atan2 (y,x);
|
||||
}
|
||||
|
||||
if (y < 0.0) {
|
||||
/* below x-axis: atan2 returns 0 .. -PI (negative) so convert to degrees and ADD to 180 */
|
||||
azimuth = 180.0 + (atan_y_per_x / (M_PI/180.0) + 180.0);
|
||||
} else {
|
||||
/* above x-axis: atan2 returns 0 .. +PI so convert to degrees */
|
||||
azimuth = atan_y_per_x / atorad;
|
||||
}
|
||||
if (y < 0.0) {
|
||||
/* below x-axis: atan2 returns 0 .. -PI (negative) so convert to degrees and ADD to 180 */
|
||||
azimuth = 180.0 + (atan_y_per_x / (M_PI/180.0) + 180.0);
|
||||
} else {
|
||||
/* above x-axis: atan2 returns 0 .. +PI so convert to degrees */
|
||||
azimuth = atan_y_per_x / atorad;
|
||||
}
|
||||
|
||||
distance = sqrt (x*x + y*y);
|
||||
distance = sqrt (x*x + y*y);
|
||||
|
||||
if (z == 0.0) {
|
||||
atan_x_pl_y_per_z = 0.0;
|
||||
} else {
|
||||
atan_x_pl_y_per_z = atan2 (z,distance);
|
||||
}
|
||||
if (z == 0.0) {
|
||||
atan_x_pl_y_per_z = 0.0;
|
||||
} else {
|
||||
atan_x_pl_y_per_z = atan2 (z,distance);
|
||||
}
|
||||
|
||||
if (distance == 0.0) {
|
||||
if (z < 0.0) {
|
||||
atan_x_pl_y_per_z = -M_PI/2.0;
|
||||
} else if (z > 0.0) {
|
||||
atan_x_pl_y_per_z = M_PI/2.0;
|
||||
}
|
||||
}
|
||||
if (distance == 0.0) {
|
||||
if (z < 0.0) {
|
||||
atan_x_pl_y_per_z = -M_PI/2.0;
|
||||
} else if (z > 0.0) {
|
||||
atan_x_pl_y_per_z = M_PI/2.0;
|
||||
}
|
||||
}
|
||||
|
||||
elevation = atan_x_pl_y_per_z / atorad;
|
||||
elevation = atan_x_pl_y_per_z / atorad;
|
||||
|
||||
// distance = sqrtf (x*x + y*y + z*z);
|
||||
// distance = sqrtf (x*x + y*y + z*z);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,74 +30,73 @@ void cart_to_azi_ele (double x, double y, double z, double& azi, double& ele);
|
|||
struct AngularVector;
|
||||
|
||||
struct CartesianVector {
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
|
||||
CartesianVector () : x(0.0), y(0.0), z(0.0) {}
|
||||
CartesianVector (double xp, double yp, double zp = 0.0) : x(xp), y(yp), z(zp) {}
|
||||
CartesianVector () : x(0.0), y(0.0), z(0.0) {}
|
||||
CartesianVector (double xp, double yp, double zp = 0.0) : x(xp), y(yp), z(zp) {}
|
||||
|
||||
CartesianVector& translate (CartesianVector& other, double xtranslate, double ytranslate, double ztranslate = 0.0) {
|
||||
other.x += xtranslate;
|
||||
other.y += ytranslate;
|
||||
other.z += ztranslate;
|
||||
return other;
|
||||
}
|
||||
CartesianVector& translate (CartesianVector& other, double xtranslate, double ytranslate, double ztranslate = 0.0) {
|
||||
other.x += xtranslate;
|
||||
other.y += ytranslate;
|
||||
other.z += ztranslate;
|
||||
return other;
|
||||
}
|
||||
|
||||
CartesianVector& scale (CartesianVector& other, double xscale, double yscale, double zscale = 1.0) {
|
||||
other.x *= xscale;
|
||||
other.y *= yscale;
|
||||
other.z *= zscale;
|
||||
return other;
|
||||
}
|
||||
CartesianVector& scale (CartesianVector& other, double xscale, double yscale, double zscale = 1.0) {
|
||||
other.x *= xscale;
|
||||
other.y *= yscale;
|
||||
other.z *= zscale;
|
||||
return other;
|
||||
}
|
||||
|
||||
void angular (AngularVector&) const;
|
||||
void angular (AngularVector&) const;
|
||||
};
|
||||
|
||||
struct AngularVector {
|
||||
double azi;
|
||||
double ele;
|
||||
double length;
|
||||
double azi;
|
||||
double ele;
|
||||
double length;
|
||||
|
||||
AngularVector () : azi(0.0), ele(0.0), length (0.0) {}
|
||||
AngularVector (double a, double e, double l = 1.0) : azi(a), ele(e), length (l) {}
|
||||
AngularVector () : azi(0.0), ele(0.0), length (0.0) {}
|
||||
AngularVector (double a, double e, double l = 1.0) : azi(a), ele(e), length (l) {}
|
||||
|
||||
AngularVector operator- (const AngularVector& other) const {
|
||||
AngularVector r;
|
||||
r.azi = azi - other.azi;
|
||||
r.ele = ele - other.ele;
|
||||
r.length = length - other.length;
|
||||
return r;
|
||||
}
|
||||
AngularVector operator- (const AngularVector& other) const {
|
||||
AngularVector r;
|
||||
r.azi = azi - other.azi;
|
||||
r.ele = ele - other.ele;
|
||||
r.length = length - other.length;
|
||||
return r;
|
||||
}
|
||||
|
||||
AngularVector operator+ (const AngularVector& other) const {
|
||||
AngularVector r;
|
||||
r.azi = azi + other.azi;
|
||||
r.ele = ele + other.ele;
|
||||
r.length = length + other.length;
|
||||
return r;
|
||||
}
|
||||
AngularVector operator+ (const AngularVector& other) const {
|
||||
AngularVector r;
|
||||
r.azi = azi + other.azi;
|
||||
r.ele = ele + other.ele;
|
||||
r.length = length + other.length;
|
||||
return r;
|
||||
}
|
||||
|
||||
bool operator== (const AngularVector& other) const {
|
||||
return fabs (azi - other.azi) <= FLT_EPSILON &&
|
||||
fabs (ele - other.ele) <= FLT_EPSILON &&
|
||||
fabs (length - other.length) <= FLT_EPSILON;
|
||||
}
|
||||
bool operator== (const AngularVector& other) const {
|
||||
return fabs (azi - other.azi) <= FLT_EPSILON &&
|
||||
fabs (ele - other.ele) <= FLT_EPSILON &&
|
||||
fabs (length - other.length) <= FLT_EPSILON;
|
||||
}
|
||||
|
||||
bool operator!= (const AngularVector& other) const {
|
||||
return fabs (azi - other.azi) > FLT_EPSILON ||
|
||||
fabs (ele - other.ele) > FLT_EPSILON ||
|
||||
fabs (length - other.length) > FLT_EPSILON;
|
||||
}
|
||||
bool operator!= (const AngularVector& other) const {
|
||||
return fabs (azi - other.azi) > FLT_EPSILON ||
|
||||
fabs (ele - other.ele) > FLT_EPSILON ||
|
||||
fabs (length - other.length) > FLT_EPSILON;
|
||||
}
|
||||
|
||||
void cartesian (CartesianVector& c) const {
|
||||
azi_ele_to_cart (azi, ele, c.x, c.y, c.z);
|
||||
}
|
||||
void cartesian (CartesianVector& c) const {
|
||||
azi_ele_to_cart (azi, ele, c.x, c.y, c.z);
|
||||
}
|
||||
};
|
||||
|
||||
inline
|
||||
void CartesianVector::angular (AngularVector& a) const {
|
||||
cart_to_azi_ele (x, y, z, a.azi, a.ele);
|
||||
inline void CartesianVector::angular (AngularVector& a) const {
|
||||
cart_to_azi_ele (x, y, z, a.azi, a.ele);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -840,12 +840,12 @@ MackieControlProtocol::handle_control_event (SurfacePort & port, Control & contr
|
|||
if (route->panner()->npanners() == 1 || (route->panner()->npanners() == 2 && route->panner()->linked()))
|
||||
{
|
||||
// assume pan for now
|
||||
AngularVector a = route->panner()->streampanner (0).get_effective_position ();
|
||||
AngularVector a = route->panner()->streampanner (0).get_effective_position ();
|
||||
|
||||
// calculate new value, and adjust
|
||||
a.azi += 180.0 * state.delta * state.sign;
|
||||
a.azi = min (180.0, a.azi);
|
||||
a.azi = max (0.0, a.azi);
|
||||
a.azi = min (180.0, a.azi);
|
||||
a.azi = max (0.0, a.azi);
|
||||
route->panner()->streampanner (0).set_position (a);
|
||||
}
|
||||
}
|
||||
|
|
@ -1005,7 +1005,7 @@ MackieControlProtocol::notify_panner_changed (RouteSignal * route_signal, bool f
|
|||
if ((panner && panner->npanners() == 1) || (panner->npanners() == 2 && panner->linked()))
|
||||
{
|
||||
AngularVector pos = route_signal->route()->panner()->streampanner(0).get_effective_position ();
|
||||
float fract = 1.0 - (pos.azi / 180.0); /* 1.0 = 0 degrees = right; 0.0 = 180 degrees = left */
|
||||
float fract = 1.0 - (pos.azi / 180.0); /* 1.0 = 0 degrees = right; 0.0 = 180 degrees = left */
|
||||
|
||||
// cache the MidiByteArray here, because the mackie led control is much lower
|
||||
// resolution than the panner control. So we save lots of byte
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue