GUI for VBAP panner actually does something (not the right thing, though)
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 17 Feb 2011 20:15:26 +0000 (20:15 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 17 Feb 2011 20:15:26 +0000 (20:15 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8892 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/panner2d.cc
gtk2_ardour/panner2d.h
libs/panners/vbap/vbap.cc
libs/panners/vbap/vbap.h

index 5054a9ee3756ef3888077d91c2adcf4530b6c6e6..56bf159ba97fb001fe1f8086abd70f698d9b8701 100644 (file)
@@ -29,6 +29,7 @@
 #include "pbd/error.h"
 #include "pbd/cartesian.h"
 #include "ardour/panner.h"
+#include "ardour/pannable.h"
 #include "ardour/speakers.h"
 
 #include "panner2d.h"
@@ -63,8 +64,11 @@ Panner2d::Target::set_text (const char* txt)
 Panner2d::Panner2d (boost::shared_ptr<Panner> p, int32_t h)
        : panner (p), width (0), height (h)
 {
-       panner->StateChanged.connect (state_connection, invalidator (*this), boost::bind (&Panner2d::handle_state_change, this), gui_context());
-       panner->Changed.connect (change_connection, invalidator (*this), boost::bind (&Panner2d::handle_position_change, this), gui_context());
+       panner->StateChanged.connect (connections, invalidator (*this), boost::bind (&Panner2d::handle_state_change, this), gui_context());
+       panner->Changed.connect (connections, invalidator (*this), boost::bind (&Panner2d::handle_position_change, this), gui_context());
+
+        panner->pannable()->pan_azimuth_control->Changed.connect (connections, invalidator(*this), boost::bind (&Panner2d::handle_position_change, this), gui_context());
+        panner->pannable()->pan_width_control->Changed.connect (connections, invalidator(*this), boost::bind (&Panner2d::handle_position_change, this), gui_context());
 
        drag_target = 0;
        set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
@@ -197,28 +201,25 @@ Panner2d::add_target (const AngularVector& a)
 void
 Panner2d::handle_state_change ()
 {
-       ENSURE_GUI_THREAD (*this, &Panner2d::handle_state_change)
-
        queue_draw ();
 }
 
 void
 Panner2d::handle_position_change ()
 {
-#ifdef PANNER_HACKS 
        uint32_t n;
-       ENSURE_GUI_THREAD (*this, &Panner2d::handle_position_change)
 
-       for (n = 0; n < pucks.size(); ++n) {
-               pucks[n]->position = panner->streampanner(n).get_position ();
-       }
+        for (uint32_t i = 0; i < pucks.size(); ++i) {
+                pucks[i]->position = panner->signal_position (i);
+        }
+
+        vector<Speaker>& speakers (panner->get_speakers()->speakers());
 
        for (n = 0; n < targets.size(); ++n) {
-               targets[n]->position = panner->output(n).position;
+               targets[n]->position = speakers[n].angles();
        }
 
        queue_draw ();
-#endif
 }
 
 void
@@ -528,11 +529,9 @@ Panner2d::handle_motion (gint evx, gint evy, GdkModifierType state)
 
                        cp.angular (drag_target->position); /* sets drag target position */
 
-#ifdef PANNER_HACKS
-                       panner->streampanner (drag_index).set_position (drag_target->position);
-#endif 
-                        
-                       queue_draw ();
+                        double degree_fract = drag_target->position.azi / 360.0;
+
+                       panner->set_position (degree_fract);
                }
        } 
 
index 4c7bd1530cd717de2ca0535d7bba9f672554bf46..9ace95cb5092e2c0a6c469b72c16da5f043b11ae 100644 (file)
@@ -130,8 +130,7 @@ class Panner2d : public Gtk::DrawingArea
        void handle_state_change ();
        void handle_position_change ();
 
-       PBD::ScopedConnection state_connection;
-       PBD::ScopedConnection change_connection;
+       PBD::ScopedConnectionList connections;
 
        /* cartesian coordinates in GTK units ; adjust to same but on a circle of radius 1.0
           and centered in the middle of our area
index fc75ae7183f0a0551a954d1b6ac122f2f0aaa6e2..56af0edbe17224d5cc43ede3b803c34de90a7ad2 100644 (file)
@@ -347,3 +347,15 @@ VBAPanner::get_speakers () const
 {
         return _speakers->parent();
 }
+
+void
+VBAPanner::set_position (double p)
+{
+        _pannable->pan_azimuth_control->set_value (p);
+}
+
+void
+VBAPanner::set_width (double p)
+{
+        _pannable->pan_width_control->set_value (p);
+}
index af3c1c0df2263e4fe4919c1599befeb496fbac4b..7aa136ac78b2789b2bbb9266e7dd5d0625cea541 100644 (file)
@@ -44,6 +44,9 @@ public:
         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>, boost::shared_ptr<Speakers>);