mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +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
|
|
@ -162,7 +162,6 @@ class Panner : public PBD::Stateful, public PBD::ScopedConnectionList
|
|||
|
||||
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_automated (AudioBuffer&, BufferSet& obufs,
|
||||
framepos_t start, framepos_t end, pframes_t nframes,
|
||||
|
|
@ -176,7 +175,7 @@ extern "C" {
|
|||
std::string name;
|
||||
int32_t in;
|
||||
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& get_speakers ();
|
||||
boost::shared_ptr<Speakers> get_speakers ();
|
||||
|
||||
/* Controllables */
|
||||
|
||||
|
|
@ -1478,7 +1478,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
void start_time_changed (framepos_t);
|
||||
void end_time_changed (framepos_t);
|
||||
|
||||
Speakers* _speakers;
|
||||
boost::shared_ptr<Speakers> _speakers;
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ public:
|
|||
virtual void remove_speaker (int id);
|
||||
virtual void move_speaker (int id, const PBD::AngularVector& new_position);
|
||||
virtual void clear_speakers ();
|
||||
uint32_t size() const { return _speakers.size(); }
|
||||
|
||||
void setup_default_speakers (uint32_t nspeakers);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
#include "ardour/session.h"
|
||||
#include "ardour/utils.h"
|
||||
|
||||
#include "pbd/stacktrace.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ARDOUR;
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,18 @@ PannerShell::configure_io (ChanCount in, ChanCount out)
|
|||
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");
|
||||
_panner.reset (p);
|
||||
_panner->configure_io (in, out);
|
||||
|
|
|
|||
|
|
@ -323,7 +323,6 @@ Session::destroy ()
|
|||
playlists.reset ();
|
||||
|
||||
delete _locations;
|
||||
delete _speakers;
|
||||
|
||||
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()
|
||||
{
|
||||
return *_speakers;
|
||||
return _speakers;
|
||||
}
|
||||
|
||||
list<string>
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
|
|||
midi_control_ui = 0;
|
||||
_step_editors = 0;
|
||||
no_questions_about_missing_files = false;
|
||||
_speakers = new Speakers;
|
||||
_speakers.reset (new Speakers);
|
||||
|
||||
AudioDiskstream::allocate_working_buffers();
|
||||
|
||||
|
|
@ -1186,9 +1186,7 @@ Session::state(bool full_state)
|
|||
}
|
||||
|
||||
node->add_child_nocopy (_speakers->get_state());
|
||||
|
||||
node->add_child_nocopy (_tempo_map->get_state());
|
||||
|
||||
node->add_child_nocopy (get_control_protocol_state());
|
||||
|
||||
if (_extra_xml) {
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ Panner1in2out::distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
|
|||
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,13 +51,7 @@ class Panner1in2out : public Panner
|
|||
|
||||
std::set<Evoral::Parameter> what_can_be_automated() const;
|
||||
|
||||
/* this class just leaves the pan law itself to be defined
|
||||
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&);
|
||||
static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
|
||||
|
||||
std::string describe_parameter (Evoral::Parameter);
|
||||
std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ Panner2in2out::distribute_one_automated (AudioBuffer& srcbuf, BufferSet& obufs,
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Panner2in2out : public Panner
|
|||
|
||||
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 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;
|
||||
};
|
||||
|
||||
VBAPanner::VBAPanner (boost::shared_ptr<Pannable> p, Speakers& s)
|
||||
VBAPanner::VBAPanner (boost::shared_ptr<Pannable> p, boost::shared_ptr<Speakers> s)
|
||||
: 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_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;
|
||||
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;
|
||||
|
||||
for (j = 0; j < _speakers.dimension(); j++) {
|
||||
for (j = 0; j < _speakers->dimension(); j++) {
|
||||
|
||||
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) {
|
||||
|
|
@ -162,12 +162,12 @@ VBAPanner::compute_gains (double gains[3], int speaker_ids[3], int azi, int ele)
|
|||
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) {
|
||||
if (_speakers->dimension() == 3) {
|
||||
gains[2] = gtmp[2];
|
||||
speaker_ids[2] = _speakers.speaker_for_tuple (i, 2);
|
||||
speaker_ids[2] = _speakers->speaker_for_tuple (i, 2);
|
||||
} else {
|
||||
gains[2] = 0.0;
|
||||
speaker_ids[2] = -1;
|
||||
|
|
@ -275,7 +275,7 @@ VBAPanner::set_state (const XMLNode& node, int /*version*/)
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
@ -289,7 +289,7 @@ VBAPanner::in() const
|
|||
ChanCount
|
||||
VBAPanner::out() const
|
||||
{
|
||||
return ChanCount (DataType::AUDIO, _speakers.n_speakers());
|
||||
return ChanCount (DataType::AUDIO, _speakers->n_speakers());
|
||||
}
|
||||
|
||||
std::set<Evoral::Parameter>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Pannable;
|
|||
class VBAPanner : public Panner
|
||||
{
|
||||
public:
|
||||
VBAPanner (boost::shared_ptr<Pannable>, Speakers& s);
|
||||
VBAPanner (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
|
||||
~VBAPanner ();
|
||||
|
||||
void configure_io (ChanCount in, ChanCount /* ignored - we use Speakers */);
|
||||
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
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);
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ private:
|
|||
};
|
||||
|
||||
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 update ();
|
||||
|
|
|
|||
|
|
@ -43,23 +43,12 @@ using namespace ARDOUR;
|
|||
using namespace PBD;
|
||||
using namespace std;
|
||||
|
||||
VBAPSpeakers* VBAPSpeakers::_instance = 0;
|
||||
|
||||
VBAPSpeakers&
|
||||
VBAPSpeakers::instance (Speakers& s)
|
||||
{
|
||||
if (_instance == 0) {
|
||||
_instance = new VBAPSpeakers (s);
|
||||
}
|
||||
|
||||
return *_instance;
|
||||
}
|
||||
|
||||
VBAPSpeakers::VBAPSpeakers (Speakers& s)
|
||||
VBAPSpeakers::VBAPSpeakers (boost::shared_ptr<Speakers> s)
|
||||
: _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 ()
|
||||
|
|
|
|||
|
|
@ -43,20 +43,17 @@ public:
|
|||
int n_tuples () const { return _matrices.size(); }
|
||||
int dimension() const { return _dimension; }
|
||||
|
||||
static VBAPSpeakers& instance (Speakers&);
|
||||
VBAPSpeakers (boost::shared_ptr<Speakers>);
|
||||
uint32_t n_speakers() const { return _speakers.size(); }
|
||||
|
||||
~VBAPSpeakers ();
|
||||
|
||||
private:
|
||||
static VBAPSpeakers* _instance;
|
||||
static const double MIN_VOL_P_SIDE_LGTH = 0.01;
|
||||
int _dimension;
|
||||
std::vector<Speaker>& _speakers;
|
||||
std::vector<Speaker> _speakers;
|
||||
PBD::ScopedConnection speaker_connection;
|
||||
|
||||
VBAPSpeakers (Speakers&);
|
||||
|
||||
struct azimuth_sorter {
|
||||
bool operator() (const Speaker& s1, const Speaker& s2) {
|
||||
return s1.angles().azi < s2.angles().azi;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue