draw speaker positions in 2d panner

git-svn-id: svn://localhost/ardour2/branches/3.0@8891 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-02-17 19:47:53 +00:00
parent 96cc6c3410
commit 1b8e8303b2
7 changed files with 26 additions and 12 deletions

View File

@ -29,6 +29,7 @@
#include "pbd/error.h"
#include "pbd/cartesian.h"
#include "ardour/panner.h"
#include "ardour/speakers.h"
#include "panner2d.h"
#include "keyboard.h"
@ -139,15 +140,15 @@ Panner2d::reset (uint32_t n_inputs)
(*x)->visible = false;
}
vector<Speaker>& speakers (panner->get_speakers()->speakers());
for (uint32_t n = 0; n < nouts; ++n) {
char buf[16];
snprintf (buf, sizeof (buf), "%d", n+1);
targets[n]->set_text (buf);
#ifdef PANNER_HACKS
targets[n]->position = panner->output(n).position;
targets[n]->position = speakers[n].angles();
targets[n]->visible = true;
#endif
}
queue_draw ();
@ -590,7 +591,8 @@ Panner2d::toggle_bypass ()
}
Panner2dWindow::Panner2dWindow (boost::shared_ptr<Panner> p, int32_t h, uint32_t inputs)
: widget (p, h)
: ArdourDialog (_("Panner (2D)"))
, widget (p, h)
, reset_button (_("Reset"))
, bypass_button (_("Bypass"))
, mute_button (_("Mute"))
@ -624,7 +626,7 @@ Panner2dWindow::Panner2dWindow (boost::shared_ptr<Panner> p, int32_t h, uint32_t
hpacker.pack_start (left_side, false, false);
hpacker.show ();
add (hpacker);
get_vbox()->pack_start (hpacker);
reset (inputs);
widget.show ();
}

View File

@ -34,6 +34,8 @@
#include "pbd/cartesian.h"
#include "ardour_dialog.h"
namespace ARDOUR {
class Panner;
}
@ -137,7 +139,7 @@ class Panner2d : public Gtk::DrawingArea
void clamp_to_circle (double& x, double& y);
};
class Panner2dWindow : public Gtk::Window
class Panner2dWindow : public ArdourDialog
{
public:
Panner2dWindow (boost::shared_ptr<ARDOUR::Panner>, int32_t height, uint32_t inputs);

View File

@ -48,6 +48,8 @@ class Panner : public PBD::Stateful, public PBD::ScopedConnectionList
Panner (boost::shared_ptr<Pannable>);
~Panner ();
virtual boost::shared_ptr<Speakers> get_speakers() const { return boost::shared_ptr<Speakers>(); }
virtual ChanCount in() const = 0;
virtual ChanCount out() const = 0;

View File

@ -341,3 +341,9 @@ VBAPanner::signal_position (uint32_t n) const
return AngularVector();
}
boost::shared_ptr<Speakers>
VBAPanner::get_speakers () const
{
return _speakers->parent();
}

View File

@ -60,6 +60,7 @@ public:
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 {

View File

@ -45,9 +45,9 @@ using namespace std;
VBAPSpeakers::VBAPSpeakers (boost::shared_ptr<Speakers> s)
: _dimension (2)
, parent (s)
, _parent (s)
{
parent->Changed.connect_same_thread (speaker_connection, boost::bind (&VBAPSpeakers::update, this));
_parent->Changed.connect_same_thread (speaker_connection, boost::bind (&VBAPSpeakers::update, this));
update ();
}
@ -60,7 +60,7 @@ VBAPSpeakers::update ()
{
int dim = 2;
_speakers = parent->speakers();
_speakers = _parent->speakers();
for (vector<Speaker>::const_iterator i = _speakers.begin(); i != _speakers.end(); ++i) {
if ((*i).angles().ele != 0.0) {

View File

@ -35,23 +35,24 @@ class Speakers;
class VBAPSpeakers : public boost::noncopyable {
public:
typedef std::vector<double> dvector;
VBAPSpeakers (boost::shared_ptr<Speakers>);
typedef std::vector<double> dvector;
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(); }
int dimension() const { return _dimension; }
VBAPSpeakers (boost::shared_ptr<Speakers>);
uint32_t n_speakers() const { return _speakers.size(); }
boost::shared_ptr<Speakers> parent() const { return _parent; }
~VBAPSpeakers ();
private:
static const double MIN_VOL_P_SIDE_LGTH = 0.01;
int _dimension;
boost::shared_ptr<Speakers> parent;
boost::shared_ptr<Speakers> _parent;
std::vector<Speaker> _speakers;
PBD::ScopedConnection speaker_connection;