Move panner bypass state up to the PannerShell so that it is preserved even when...
[ardour.git] / libs / panners / vbap / vbap.h
index cf010cc33190a486771429848f3f5c462cd8bf14..752a0c9be664d3fd1733a21aef67e98980d77414 100644 (file)
@@ -37,16 +37,19 @@ 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 */);
         ChanCount in() const;
         ChanCount out() const;
 
+        void set_position (double);
+        void set_width (double);
+
         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);
 
@@ -55,24 +58,26 @@ public:
         std::string describe_parameter (Evoral::Parameter);
         std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
 
-       XMLNode& state (bool full_state);
        XMLNode& get_state ();
-       int set_state (const XMLNode&, int version);
 
+        PBD::AngularVector signal_position (uint32_t n) const;
+        boost::shared_ptr<Speakers> get_speakers() const;
 
 private:
         struct Signal {
             PBD::AngularVector direction;
-            double gains[3];
-            double desired_gains[3];
-            int    outputs[3];
-            int    desired_outputs[3];
+            std::vector<double> gains; /* most recently used gain for all speakers */
+
+            int outputs[3];  /* most recent set of outputs used (2 or 3, depending on dimension) */
+            int desired_outputs[3]; /* outputs to use the next time we distribute */
+            double desired_gains[3]; /* target gains for desired_outputs */
 
-            Signal (Session&, VBAPanner&, uint32_t which);
+            Signal (Session&, VBAPanner&, uint32_t which, uint32_t n_speakers);
+            void resize_gains (uint32_t n_speakers);
         };
 
         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 ();