mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
more progress on speakers/vbap etc. etc (still a work in progress)
git-svn-id: svn://localhost/ardour2/branches/3.0@8887 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
97e2aedc2d
commit
da144ab5ed
17 changed files with 70 additions and 75 deletions
|
|
@ -33,13 +33,13 @@ using namespace Gtkmm2ext;
|
||||||
|
|
||||||
SpeakerDialog::SpeakerDialog ()
|
SpeakerDialog::SpeakerDialog ()
|
||||||
: ArdourDialog (_("Speaker Configuration"))
|
: ArdourDialog (_("Speaker Configuration"))
|
||||||
|
, aspect_frame ("", 0.5, 0.5, 1.0, false)
|
||||||
, azimuth_adjustment (0, 0.0, 360.0, 10.0, 1.0)
|
, azimuth_adjustment (0, 0.0, 360.0, 10.0, 1.0)
|
||||||
, azimuth_spinner (azimuth_adjustment)
|
, azimuth_spinner (azimuth_adjustment)
|
||||||
, add_speaker_button (_("Add Speaker"))
|
, add_speaker_button (_("Add Speaker"))
|
||||||
, use_system_button (_("Use System"))
|
, use_system_button (_("Use System"))
|
||||||
|
|
||||||
{
|
{
|
||||||
set_size_request (400, 200);
|
|
||||||
|
|
||||||
side_vbox.set_homogeneous (false);
|
side_vbox.set_homogeneous (false);
|
||||||
side_vbox.set_border_width (9);
|
side_vbox.set_border_width (9);
|
||||||
|
|
@ -48,14 +48,20 @@ SpeakerDialog::SpeakerDialog ()
|
||||||
side_vbox.pack_start (add_speaker_button, false, false);
|
side_vbox.pack_start (add_speaker_button, false, false);
|
||||||
side_vbox.pack_start (use_system_button, false, false);
|
side_vbox.pack_start (use_system_button, false, false);
|
||||||
|
|
||||||
|
aspect_frame.set_size_request (200, 200);
|
||||||
|
aspect_frame.set_shadow_type (SHADOW_NONE);
|
||||||
|
aspect_frame.add (darea);
|
||||||
|
|
||||||
hbox.set_spacing (6);
|
hbox.set_spacing (6);
|
||||||
hbox.set_border_width (6);
|
hbox.set_border_width (6);
|
||||||
hbox.pack_start (darea, true, true);
|
hbox.pack_start (aspect_frame, true, true);
|
||||||
hbox.pack_start (side_vbox, false, false);
|
hbox.pack_start (side_vbox, false, false);
|
||||||
|
|
||||||
get_vbox()->pack_start (hbox);
|
get_vbox()->pack_start (hbox);
|
||||||
get_vbox()->show_all ();
|
get_vbox()->show_all ();
|
||||||
|
|
||||||
|
darea.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
|
||||||
|
|
||||||
darea.signal_size_allocate().connect (sigc::mem_fun (*this, &SpeakerDialog::darea_size_allocate));
|
darea.signal_size_allocate().connect (sigc::mem_fun (*this, &SpeakerDialog::darea_size_allocate));
|
||||||
darea.signal_expose_event().connect (sigc::mem_fun (*this, &SpeakerDialog::darea_expose_event));
|
darea.signal_expose_event().connect (sigc::mem_fun (*this, &SpeakerDialog::darea_expose_event));
|
||||||
darea.signal_button_press_event().connect (sigc::mem_fun (*this, &SpeakerDialog::darea_button_press_event));
|
darea.signal_button_press_event().connect (sigc::mem_fun (*this, &SpeakerDialog::darea_button_press_event));
|
||||||
|
|
@ -66,9 +72,9 @@ SpeakerDialog::SpeakerDialog ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SpeakerDialog::set_speakers (const Speakers& s)
|
SpeakerDialog::set_speakers (boost::shared_ptr<Speakers> s)
|
||||||
{
|
{
|
||||||
speakers = s;
|
speakers = *s;
|
||||||
}
|
}
|
||||||
|
|
||||||
Speakers
|
Speakers
|
||||||
|
|
@ -226,7 +232,7 @@ SpeakerDialog::darea_button_press_event (GdkEventButton *ev)
|
||||||
switch (ev->button) {
|
switch (ev->button) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
find_closest_object (ev->x, ev->y, drag_index);
|
drag_index = find_closest_object (ev->x, ev->y);
|
||||||
drag_x = (int) floor (ev->x);
|
drag_x = (int) floor (ev->x);
|
||||||
drag_y = (int) floor (ev->y);
|
drag_y = (int) floor (ev->y);
|
||||||
state = (GdkModifierType) ev->state;
|
state = (GdkModifierType) ev->state;
|
||||||
|
|
@ -288,19 +294,16 @@ SpeakerDialog::darea_button_release_event (GdkEventButton *ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SpeakerDialog::find_closest_object (gdouble x, gdouble y, int& which)
|
SpeakerDialog::find_closest_object (gdouble x, gdouble y)
|
||||||
{
|
{
|
||||||
float distance;
|
float distance;
|
||||||
float best_distance = FLT_MAX;
|
float best_distance = FLT_MAX;
|
||||||
int pwhich = -1;
|
int n = 0;
|
||||||
|
int which = -1;
|
||||||
|
|
||||||
which = 0;
|
for (vector<Speaker>::iterator i = speakers.speakers().begin(); i != speakers.speakers().end(); ++i, ++n) {
|
||||||
pwhich = 0;
|
|
||||||
|
|
||||||
for (vector<Speaker>::iterator i = speakers.speakers().begin(); i != speakers.speakers().end(); ++i, ++pwhich) {
|
|
||||||
|
|
||||||
Speaker& candidate (*i);
|
Speaker& candidate (*i);
|
||||||
|
|
||||||
CartesianVector c;
|
CartesianVector c;
|
||||||
|
|
||||||
candidate.angles().cartesian (c);
|
candidate.angles().cartesian (c);
|
||||||
|
|
@ -309,18 +312,18 @@ SpeakerDialog::find_closest_object (gdouble x, gdouble y, int& which)
|
||||||
distance = sqrt ((c.x - x) * (c.x - x) +
|
distance = sqrt ((c.x - x) * (c.x - x) +
|
||||||
(c.y - y) * (c.y - y));
|
(c.y - y) * (c.y - y));
|
||||||
|
|
||||||
|
|
||||||
if (distance < best_distance) {
|
if (distance < best_distance) {
|
||||||
best_distance = distance;
|
best_distance = distance;
|
||||||
which = pwhich;
|
which = n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (best_distance > 20) { // arbitrary
|
if (best_distance > 20) { // arbitrary
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return which;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include <gtkmm/spinbutton.h>
|
#include <gtkmm/spinbutton.h>
|
||||||
#include <gtkmm/box.h>
|
#include <gtkmm/box.h>
|
||||||
#include <gtkmm/adjustment.h>
|
#include <gtkmm/adjustment.h>
|
||||||
|
#include <gtkmm/aspectframe.h>
|
||||||
|
|
||||||
#include "ardour/speakers.h"
|
#include "ardour/speakers.h"
|
||||||
|
|
||||||
|
|
@ -35,12 +36,13 @@ class SpeakerDialog : public ArdourDialog
|
||||||
SpeakerDialog ();
|
SpeakerDialog ();
|
||||||
|
|
||||||
ARDOUR::Speakers get_speakers() const;
|
ARDOUR::Speakers get_speakers() const;
|
||||||
void set_speakers (const ARDOUR::Speakers&);
|
void set_speakers (boost::shared_ptr<ARDOUR::Speakers>);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ARDOUR::Speakers speakers;
|
ARDOUR::Speakers speakers;
|
||||||
Gtk::HBox hbox;
|
Gtk::HBox hbox;
|
||||||
Gtk::VBox side_vbox;
|
Gtk::VBox side_vbox;
|
||||||
|
Gtk::AspectFrame aspect_frame;
|
||||||
Gtk::DrawingArea darea;
|
Gtk::DrawingArea darea;
|
||||||
Gtk::Adjustment azimuth_adjustment;
|
Gtk::Adjustment azimuth_adjustment;
|
||||||
Gtk::SpinButton azimuth_spinner;
|
Gtk::SpinButton azimuth_spinner;
|
||||||
|
|
@ -63,7 +65,7 @@ class SpeakerDialog : public ArdourDialog
|
||||||
void clamp_to_circle (double& x, double& y);
|
void clamp_to_circle (double& x, double& y);
|
||||||
void gtk_to_cart (PBD::CartesianVector& c) const;
|
void gtk_to_cart (PBD::CartesianVector& c) const;
|
||||||
void cart_to_gtk (PBD::CartesianVector& c) const;
|
void cart_to_gtk (PBD::CartesianVector& c) const;
|
||||||
int find_closest_object (gdouble x, gdouble y, int& which);
|
int find_closest_object (gdouble x, gdouble y);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_gtk_speaker_dialog_h__ */
|
#endif /* __ardour_gtk_speaker_dialog_h__ */
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,6 @@ class Panner : public PBD::Stateful, public PBD::ScopedConnectionList
|
||||||
|
|
||||||
XMLNode& get_state ();
|
XMLNode& get_state ();
|
||||||
|
|
||||||
|
|
||||||
virtual void distribute_one (AudioBuffer&, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which) = 0;
|
virtual void distribute_one (AudioBuffer&, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which) = 0;
|
||||||
virtual void distribute_one_automated (AudioBuffer&, BufferSet& obufs,
|
virtual void distribute_one_automated (AudioBuffer&, BufferSet& obufs,
|
||||||
framepos_t start, framepos_t end, pframes_t nframes,
|
framepos_t start, framepos_t end, pframes_t nframes,
|
||||||
|
|
@ -176,7 +175,7 @@ extern "C" {
|
||||||
std::string name;
|
std::string name;
|
||||||
int32_t in;
|
int32_t in;
|
||||||
int32_t out;
|
int32_t out;
|
||||||
ARDOUR::Panner* (*factory)(boost::shared_ptr<ARDOUR::Pannable>, ARDOUR::Speakers&);
|
ARDOUR::Panner* (*factory)(boost::shared_ptr<ARDOUR::Pannable>, boost::shared_ptr<ARDOUR::Speakers>);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -716,7 +716,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||||
|
|
||||||
/* Speakers */
|
/* Speakers */
|
||||||
|
|
||||||
Speakers& get_speakers ();
|
boost::shared_ptr<Speakers> get_speakers ();
|
||||||
|
|
||||||
/* Controllables */
|
/* Controllables */
|
||||||
|
|
||||||
|
|
@ -1478,7 +1478,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||||
void start_time_changed (framepos_t);
|
void start_time_changed (framepos_t);
|
||||||
void end_time_changed (framepos_t);
|
void end_time_changed (framepos_t);
|
||||||
|
|
||||||
Speakers* _speakers;
|
boost::shared_ptr<Speakers> _speakers;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ARDOUR
|
} // namespace ARDOUR
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ public:
|
||||||
virtual void remove_speaker (int id);
|
virtual void remove_speaker (int id);
|
||||||
virtual void move_speaker (int id, const PBD::AngularVector& new_position);
|
virtual void move_speaker (int id, const PBD::AngularVector& new_position);
|
||||||
virtual void clear_speakers ();
|
virtual void clear_speakers ();
|
||||||
|
uint32_t size() const { return _speakers.size(); }
|
||||||
|
|
||||||
void setup_default_speakers (uint32_t nspeakers);
|
void setup_default_speakers (uint32_t nspeakers);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
#include "ardour/utils.h"
|
#include "ardour/utils.h"
|
||||||
|
|
||||||
|
#include "pbd/stacktrace.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,18 @@ PannerShell::configure_io (ChanCount in, ChanCount out)
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
Panner* p = pi->descriptor.factory (_pannable, _session.get_speakers());
|
boost::shared_ptr<Speakers> speakers = _session.get_speakers ();
|
||||||
|
|
||||||
|
if (nouts != speakers->size()) {
|
||||||
|
/* hmm, output count doesn't match session speaker count so
|
||||||
|
create a new speaker set.
|
||||||
|
*/
|
||||||
|
Speakers* s = new Speakers ();
|
||||||
|
s->setup_default_speakers (nouts);
|
||||||
|
speakers.reset (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
Panner* p = pi->descriptor.factory (_pannable, speakers);
|
||||||
boost_debug_shared_ptr_mark_interesting (p, "Panner");
|
boost_debug_shared_ptr_mark_interesting (p, "Panner");
|
||||||
_panner.reset (p);
|
_panner.reset (p);
|
||||||
_panner->configure_io (in, out);
|
_panner->configure_io (in, out);
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,6 @@ Session::destroy ()
|
||||||
playlists.reset ();
|
playlists.reset ();
|
||||||
|
|
||||||
delete _locations;
|
delete _locations;
|
||||||
delete _speakers;
|
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n");
|
DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n");
|
||||||
|
|
||||||
|
|
@ -4175,10 +4174,10 @@ Session::ensure_search_path_includes (const string& path, DataType type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Speakers&
|
boost::shared_ptr<Speakers>
|
||||||
Session::get_speakers()
|
Session::get_speakers()
|
||||||
{
|
{
|
||||||
return *_speakers;
|
return _speakers;
|
||||||
}
|
}
|
||||||
|
|
||||||
list<string>
|
list<string>
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
|
||||||
midi_control_ui = 0;
|
midi_control_ui = 0;
|
||||||
_step_editors = 0;
|
_step_editors = 0;
|
||||||
no_questions_about_missing_files = false;
|
no_questions_about_missing_files = false;
|
||||||
_speakers = new Speakers;
|
_speakers.reset (new Speakers);
|
||||||
|
|
||||||
AudioDiskstream::allocate_working_buffers();
|
AudioDiskstream::allocate_working_buffers();
|
||||||
|
|
||||||
|
|
@ -1186,9 +1186,7 @@ Session::state(bool full_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
node->add_child_nocopy (_speakers->get_state());
|
node->add_child_nocopy (_speakers->get_state());
|
||||||
|
|
||||||
node->add_child_nocopy (_tempo_map->get_state());
|
node->add_child_nocopy (_tempo_map->get_state());
|
||||||
|
|
||||||
node->add_child_nocopy (get_control_protocol_state());
|
node->add_child_nocopy (get_control_protocol_state());
|
||||||
|
|
||||||
if (_extra_xml) {
|
if (_extra_xml) {
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,7 @@ Panner1in2out::distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
|
||||||
|
|
||||||
|
|
||||||
Panner*
|
Panner*
|
||||||
Panner1in2out::factory (boost::shared_ptr<Pannable> p, Speakers& /* ignored */)
|
Panner1in2out::factory (boost::shared_ptr<Pannable> p, boost::shared_ptr<Speakers> /* ignored */)
|
||||||
{
|
{
|
||||||
return new Panner1in2out (p);
|
return new Panner1in2out (p);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,13 +51,7 @@ class Panner1in2out : public Panner
|
||||||
|
|
||||||
std::set<Evoral::Parameter> what_can_be_automated() const;
|
std::set<Evoral::Parameter> what_can_be_automated() const;
|
||||||
|
|
||||||
/* this class just leaves the pan law itself to be defined
|
static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
|
||||||
by the update(), do_distribute_automated()
|
|
||||||
methods. derived classes also need a factory method
|
|
||||||
and a type name. See EqualPowerStereoPanner as an example.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Panner* factory (boost::shared_ptr<Pannable>, Speakers&);
|
|
||||||
|
|
||||||
std::string describe_parameter (Evoral::Parameter);
|
std::string describe_parameter (Evoral::Parameter);
|
||||||
std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
|
std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,7 @@ Panner2in2out::distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
|
||||||
}
|
}
|
||||||
|
|
||||||
Panner*
|
Panner*
|
||||||
Panner2in2out::factory (boost::shared_ptr<Pannable> p, Speakers& /* ignored */)
|
Panner2in2out::factory (boost::shared_ptr<Pannable> p, boost::shared_ptr<Speakers> /* ignored */)
|
||||||
{
|
{
|
||||||
return new Panner2in2out (p);
|
return new Panner2in2out (p);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ class Panner2in2out : public Panner
|
||||||
|
|
||||||
std::set<Evoral::Parameter> what_can_be_automated() const;
|
std::set<Evoral::Parameter> what_can_be_automated() const;
|
||||||
|
|
||||||
static Panner* factory (boost::shared_ptr<Pannable>, Speakers&);
|
static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
|
||||||
|
|
||||||
std::string describe_parameter (Evoral::Parameter);
|
std::string describe_parameter (Evoral::Parameter);
|
||||||
std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
|
std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,9 @@ VBAPanner::Signal::Signal (Session& session, VBAPanner& p, uint32_t n)
|
||||||
desired_outputs[0] = desired_outputs[1] = desired_outputs[2] = -1;
|
desired_outputs[0] = desired_outputs[1] = desired_outputs[2] = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
VBAPanner::VBAPanner (boost::shared_ptr<Pannable> p, Speakers& s)
|
VBAPanner::VBAPanner (boost::shared_ptr<Pannable> p, boost::shared_ptr<Speakers> s)
|
||||||
: Panner (p)
|
: Panner (p)
|
||||||
, _speakers (VBAPSpeakers::instance (s))
|
, _speakers (new VBAPSpeakers (s))
|
||||||
{
|
{
|
||||||
_pannable->pan_azimuth_control->Changed.connect_same_thread (*this, boost::bind (&VBAPanner::update, this));
|
_pannable->pan_azimuth_control->Changed.connect_same_thread (*this, boost::bind (&VBAPanner::update, this));
|
||||||
_pannable->pan_width_control->Changed.connect_same_thread (*this, boost::bind (&VBAPanner::update, this));
|
_pannable->pan_width_control->Changed.connect_same_thread (*this, boost::bind (&VBAPanner::update, this));
|
||||||
|
|
@ -138,16 +138,16 @@ VBAPanner::compute_gains (double gains[3], int speaker_ids[3], int azi, int ele)
|
||||||
gains[0] = gains[1] = gains[2] = 0;
|
gains[0] = gains[1] = gains[2] = 0;
|
||||||
speaker_ids[0] = speaker_ids[1] = speaker_ids[2] = 0;
|
speaker_ids[0] = speaker_ids[1] = speaker_ids[2] = 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++) {
|
for (k = 0; k < _speakers->dimension(); k++) {
|
||||||
gtmp[j] += cartdir[k] * _speakers.matrix(i)[j*_speakers.dimension()+k];
|
gtmp[j] += cartdir[k] * _speakers->matrix(i)[j*_speakers->dimension()+k];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gtmp[j] < small_g) {
|
if (gtmp[j] < small_g) {
|
||||||
|
|
@ -162,12 +162,12 @@ VBAPanner::compute_gains (double gains[3], int speaker_ids[3], int azi, int ele)
|
||||||
gains[0] = gtmp[0];
|
gains[0] = gtmp[0];
|
||||||
gains[1] = gtmp[1];
|
gains[1] = gtmp[1];
|
||||||
|
|
||||||
speaker_ids[0] = _speakers.speaker_for_tuple (i, 0);
|
speaker_ids[0] = _speakers->speaker_for_tuple (i, 0);
|
||||||
speaker_ids[1] = _speakers.speaker_for_tuple (i, 1);
|
speaker_ids[1] = _speakers->speaker_for_tuple (i, 1);
|
||||||
|
|
||||||
if (_speakers.dimension() == 3) {
|
if (_speakers->dimension() == 3) {
|
||||||
gains[2] = gtmp[2];
|
gains[2] = gtmp[2];
|
||||||
speaker_ids[2] = _speakers.speaker_for_tuple (i, 2);
|
speaker_ids[2] = _speakers->speaker_for_tuple (i, 2);
|
||||||
} else {
|
} else {
|
||||||
gains[2] = 0.0;
|
gains[2] = 0.0;
|
||||||
speaker_ids[2] = -1;
|
speaker_ids[2] = -1;
|
||||||
|
|
@ -275,7 +275,7 @@ VBAPanner::set_state (const XMLNode& node, int /*version*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
Panner*
|
Panner*
|
||||||
VBAPanner::factory (boost::shared_ptr<Pannable> p, Speakers& s)
|
VBAPanner::factory (boost::shared_ptr<Pannable> p, boost::shared_ptr<Speakers> s)
|
||||||
{
|
{
|
||||||
return new VBAPanner (p, s);
|
return new VBAPanner (p, s);
|
||||||
}
|
}
|
||||||
|
|
@ -289,7 +289,7 @@ VBAPanner::in() const
|
||||||
ChanCount
|
ChanCount
|
||||||
VBAPanner::out() const
|
VBAPanner::out() const
|
||||||
{
|
{
|
||||||
return ChanCount (DataType::AUDIO, _speakers.n_speakers());
|
return ChanCount (DataType::AUDIO, _speakers->n_speakers());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<Evoral::Parameter>
|
std::set<Evoral::Parameter>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class Pannable;
|
||||||
class VBAPanner : public Panner
|
class VBAPanner : public Panner
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VBAPanner (boost::shared_ptr<Pannable>, Speakers& s);
|
VBAPanner (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
|
||||||
~VBAPanner ();
|
~VBAPanner ();
|
||||||
|
|
||||||
void configure_io (ChanCount in, ChanCount /* ignored - we use Speakers */);
|
void configure_io (ChanCount in, ChanCount /* ignored - we use Speakers */);
|
||||||
|
|
@ -46,7 +46,7 @@ public:
|
||||||
|
|
||||||
std::set<Evoral::Parameter> what_can_be_automated() const;
|
std::set<Evoral::Parameter> what_can_be_automated() const;
|
||||||
|
|
||||||
static Panner* factory (boost::shared_ptr<Pannable>, Speakers& s);
|
static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
|
||||||
|
|
||||||
void distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes);
|
void distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes);
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<Signal*> _signals;
|
std::vector<Signal*> _signals;
|
||||||
VBAPSpeakers& _speakers;
|
boost::shared_ptr<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 update ();
|
||||||
|
|
|
||||||
|
|
@ -43,23 +43,12 @@ using namespace ARDOUR;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
VBAPSpeakers* VBAPSpeakers::_instance = 0;
|
VBAPSpeakers::VBAPSpeakers (boost::shared_ptr<Speakers> s)
|
||||||
|
|
||||||
VBAPSpeakers&
|
|
||||||
VBAPSpeakers::instance (Speakers& s)
|
|
||||||
{
|
|
||||||
if (_instance == 0) {
|
|
||||||
_instance = new VBAPSpeakers (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
return *_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
VBAPSpeakers::VBAPSpeakers (Speakers& s)
|
|
||||||
: _dimension (2)
|
: _dimension (2)
|
||||||
, _speakers (s.speakers())
|
, _speakers (s->speakers())
|
||||||
{
|
{
|
||||||
s.Changed.connect_same_thread (speaker_connection, boost::bind (&VBAPSpeakers::update, this));
|
// s.Changed.connect_same_thread (speaker_connection, boost::bind (&VBAPSpeakers::update, this));
|
||||||
|
update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
VBAPSpeakers::~VBAPSpeakers ()
|
VBAPSpeakers::~VBAPSpeakers ()
|
||||||
|
|
|
||||||
|
|
@ -43,20 +43,17 @@ public:
|
||||||
int n_tuples () const { return _matrices.size(); }
|
int n_tuples () const { return _matrices.size(); }
|
||||||
int dimension() const { return _dimension; }
|
int dimension() const { return _dimension; }
|
||||||
|
|
||||||
static VBAPSpeakers& instance (Speakers&);
|
VBAPSpeakers (boost::shared_ptr<Speakers>);
|
||||||
uint32_t n_speakers() const { return _speakers.size(); }
|
uint32_t n_speakers() const { return _speakers.size(); }
|
||||||
|
|
||||||
~VBAPSpeakers ();
|
~VBAPSpeakers ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static VBAPSpeakers* _instance;
|
|
||||||
static const double MIN_VOL_P_SIDE_LGTH = 0.01;
|
static const double MIN_VOL_P_SIDE_LGTH = 0.01;
|
||||||
int _dimension;
|
int _dimension;
|
||||||
std::vector<Speaker>& _speakers;
|
std::vector<Speaker> _speakers;
|
||||||
PBD::ScopedConnection speaker_connection;
|
PBD::ScopedConnection speaker_connection;
|
||||||
|
|
||||||
VBAPSpeakers (Speakers&);
|
|
||||||
|
|
||||||
struct azimuth_sorter {
|
struct azimuth_sorter {
|
||||||
bool operator() (const Speaker& s1, const Speaker& s2) {
|
bool operator() (const Speaker& s1, const Speaker& s2) {
|
||||||
return s1.angles().azi < s2.angles().azi;
|
return s1.angles().azi < s2.angles().azi;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue