diff options
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/panner.h | 17 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 7 | ||||
-rw-r--r-- | libs/ardour/ardour/vbap.h | 10 | ||||
-rw-r--r-- | libs/ardour/ardour/vbap_speakers.h | 28 |
4 files changed, 48 insertions, 14 deletions
diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 087471032d..da68ed8578 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -203,13 +203,14 @@ class Panner : public SessionObject, public Automatable { public: struct Output { - float x; - float y; - pan_t current_pan; - pan_t desired_pan; - - Output (float xp, float yp) - : x (xp), y (yp), current_pan (0), desired_pan (0) {} + float x; + float y; + float z; + pan_t current_pan; + pan_t desired_pan; + + Output (float xp, float yp, float zp = 0.0) + : x (xp), y (yp), z (zp), current_pan (0), desired_pan (0) {} }; @@ -320,6 +321,8 @@ public: static float current_automation_version_number; + void setup_speakers (uint32_t nouts); + /* old school automation handling */ std::string automation_path; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 91034cd034..d6dab480a7 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -52,6 +52,7 @@ #include "ardour/location.h" #include "ardour/timecode.h" #include "ardour/interpolation.h" +#include "ardour/vbap_speakers.h" #ifdef HAVE_JACK_SESSION #include <jack/session.h> @@ -723,6 +724,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi static PBD::Signal0<void> SendFeedback; + /* Speakers */ + + VBAPSpeakers& get_speakers (); + /* Controllables */ boost::shared_ptr<PBD::Controllable> controllable_by_id (const PBD::ID&); @@ -1462,6 +1467,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void start_time_changed (framepos_t); void end_time_changed (framepos_t); + + VBAPSpeakers* _speakers; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/vbap.h b/libs/ardour/ardour/vbap.h index 922a2a4631..b6c2b7a710 100644 --- a/libs/ardour/ardour/vbap.h +++ b/libs/ardour/ardour/vbap.h @@ -36,9 +36,19 @@ class VBAPanner : public StreamPanner { ~VBAPanner (); 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); 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 */ + + int load (std::istream&, std::string path, uint32_t&) { return 0; } + private: double _azimuth; /* direction for the signal source */ double _elevation; /* elevation of the signal source */ diff --git a/libs/ardour/ardour/vbap_speakers.h b/libs/ardour/ardour/vbap_speakers.h index cf1bbab691..054079f739 100644 --- a/libs/ardour/ardour/vbap_speakers.h +++ b/libs/ardour/ardour/vbap_speakers.h @@ -43,6 +43,7 @@ class VBAPSpeakers { }; static const int MAX_TRIPLET_AMOUNT = 60; + typedef std::vector<double> dvector; VBAPSpeakers (); ~VBAPSpeakers (); @@ -50,8 +51,9 @@ class VBAPSpeakers { int add_speaker (double direction, double elevation = 0.0); void remove_speaker (int id); void move_speaker (int id, double direction, double elevation = 0.0); - - const double* matrix (int tuple) const { return _matrices[tuple]; } + void clear_speakers (); + + 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(); } @@ -76,9 +78,21 @@ class VBAPSpeakers { void move (double azimuth, double elevation); }; - std::vector<Speaker> _speakers; - std::vector<double[9]> _matrices; /* holds matrices for a given speaker combinations */ - std::vector<int[3]> _speaker_tuples; /* holds speakers IDs for a given combination */ + struct twoDmatrix : public dvector { + twoDmatrix() : dvector (4, 0.0) {} + }; + + struct threeDmatrix : public dvector { + threeDmatrix() : dvector (9, 0.0) {} + }; + + struct tmatrix : public dvector { + tmatrix() : dvector (3, 0.0) {} + }; + + std::vector<Speaker> _speakers; + 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 { @@ -98,8 +112,8 @@ class VBAPSpeakers { 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_ls_triplets (struct ls_triplet_chain **ls_triplets); - void choose_ls_pairs (); + 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); }; |