GUI for VBAP panner actually does something (not the right thing, though)

git-svn-id: svn://localhost/ardour2/branches/3.0@8892 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-02-17 20:15:26 +00:00
parent 1b8e8303b2
commit e9e1800d86
4 changed files with 31 additions and 18 deletions

View 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);
}
}

View 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

View 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);
}

View 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>);