mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
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:
parent
96cc6c3410
commit
1b8e8303b2
7 changed files with 26 additions and 12 deletions
|
|
@ -29,6 +29,7 @@
|
||||||
#include "pbd/error.h"
|
#include "pbd/error.h"
|
||||||
#include "pbd/cartesian.h"
|
#include "pbd/cartesian.h"
|
||||||
#include "ardour/panner.h"
|
#include "ardour/panner.h"
|
||||||
|
#include "ardour/speakers.h"
|
||||||
|
|
||||||
#include "panner2d.h"
|
#include "panner2d.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
|
|
@ -139,15 +140,15 @@ Panner2d::reset (uint32_t n_inputs)
|
||||||
(*x)->visible = false;
|
(*x)->visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<Speaker>& speakers (panner->get_speakers()->speakers());
|
||||||
|
|
||||||
for (uint32_t n = 0; n < nouts; ++n) {
|
for (uint32_t n = 0; n < nouts; ++n) {
|
||||||
char buf[16];
|
char buf[16];
|
||||||
|
|
||||||
snprintf (buf, sizeof (buf), "%d", n+1);
|
snprintf (buf, sizeof (buf), "%d", n+1);
|
||||||
targets[n]->set_text (buf);
|
targets[n]->set_text (buf);
|
||||||
#ifdef PANNER_HACKS
|
targets[n]->position = speakers[n].angles();
|
||||||
targets[n]->position = panner->output(n).position;
|
|
||||||
targets[n]->visible = true;
|
targets[n]->visible = true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
queue_draw ();
|
queue_draw ();
|
||||||
|
|
@ -590,7 +591,8 @@ Panner2d::toggle_bypass ()
|
||||||
}
|
}
|
||||||
|
|
||||||
Panner2dWindow::Panner2dWindow (boost::shared_ptr<Panner> p, int32_t h, uint32_t inputs)
|
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"))
|
, reset_button (_("Reset"))
|
||||||
, bypass_button (_("Bypass"))
|
, bypass_button (_("Bypass"))
|
||||||
, mute_button (_("Mute"))
|
, 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.pack_start (left_side, false, false);
|
||||||
hpacker.show ();
|
hpacker.show ();
|
||||||
|
|
||||||
add (hpacker);
|
get_vbox()->pack_start (hpacker);
|
||||||
reset (inputs);
|
reset (inputs);
|
||||||
widget.show ();
|
widget.show ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
#include "pbd/cartesian.h"
|
#include "pbd/cartesian.h"
|
||||||
|
|
||||||
|
#include "ardour_dialog.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class Panner;
|
class Panner;
|
||||||
}
|
}
|
||||||
|
|
@ -137,7 +139,7 @@ class Panner2d : public Gtk::DrawingArea
|
||||||
void clamp_to_circle (double& x, double& y);
|
void clamp_to_circle (double& x, double& y);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Panner2dWindow : public Gtk::Window
|
class Panner2dWindow : public ArdourDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Panner2dWindow (boost::shared_ptr<ARDOUR::Panner>, int32_t height, uint32_t inputs);
|
Panner2dWindow (boost::shared_ptr<ARDOUR::Panner>, int32_t height, uint32_t inputs);
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ class Panner : public PBD::Stateful, public PBD::ScopedConnectionList
|
||||||
Panner (boost::shared_ptr<Pannable>);
|
Panner (boost::shared_ptr<Pannable>);
|
||||||
~Panner ();
|
~Panner ();
|
||||||
|
|
||||||
|
virtual boost::shared_ptr<Speakers> get_speakers() const { return boost::shared_ptr<Speakers>(); }
|
||||||
|
|
||||||
virtual ChanCount in() const = 0;
|
virtual ChanCount in() const = 0;
|
||||||
virtual ChanCount out() const = 0;
|
virtual ChanCount out() const = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -341,3 +341,9 @@ VBAPanner::signal_position (uint32_t n) const
|
||||||
|
|
||||||
return AngularVector();
|
return AngularVector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<Speakers>
|
||||||
|
VBAPanner::get_speakers () const
|
||||||
|
{
|
||||||
|
return _speakers->parent();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ public:
|
||||||
int set_state (const XMLNode&, int version);
|
int set_state (const XMLNode&, int version);
|
||||||
|
|
||||||
PBD::AngularVector signal_position (uint32_t n) const;
|
PBD::AngularVector signal_position (uint32_t n) const;
|
||||||
|
boost::shared_ptr<Speakers> get_speakers() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Signal {
|
struct Signal {
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ using namespace std;
|
||||||
|
|
||||||
VBAPSpeakers::VBAPSpeakers (boost::shared_ptr<Speakers> s)
|
VBAPSpeakers::VBAPSpeakers (boost::shared_ptr<Speakers> s)
|
||||||
: _dimension (2)
|
: _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 ();
|
update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ VBAPSpeakers::update ()
|
||||||
{
|
{
|
||||||
int dim = 2;
|
int dim = 2;
|
||||||
|
|
||||||
_speakers = parent->speakers();
|
_speakers = _parent->speakers();
|
||||||
|
|
||||||
for (vector<Speaker>::const_iterator i = _speakers.begin(); i != _speakers.end(); ++i) {
|
for (vector<Speaker>::const_iterator i = _speakers.begin(); i != _speakers.end(); ++i) {
|
||||||
if ((*i).angles().ele != 0.0) {
|
if ((*i).angles().ele != 0.0) {
|
||||||
|
|
|
||||||
|
|
@ -35,23 +35,24 @@ class Speakers;
|
||||||
|
|
||||||
class VBAPSpeakers : public boost::noncopyable {
|
class VBAPSpeakers : public boost::noncopyable {
|
||||||
public:
|
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]; }
|
const dvector matrix (int tuple) const { return _matrices[tuple]; }
|
||||||
int speaker_for_tuple (int tuple, int which) const { return _speaker_tuples[tuple][which]; }
|
int speaker_for_tuple (int tuple, int which) const { return _speaker_tuples[tuple][which]; }
|
||||||
|
|
||||||
int n_tuples () const { return _matrices.size(); }
|
int n_tuples () const { return _matrices.size(); }
|
||||||
int dimension() const { return _dimension; }
|
int dimension() const { return _dimension; }
|
||||||
|
|
||||||
VBAPSpeakers (boost::shared_ptr<Speakers>);
|
|
||||||
uint32_t n_speakers() const { return _speakers.size(); }
|
uint32_t n_speakers() const { return _speakers.size(); }
|
||||||
|
boost::shared_ptr<Speakers> parent() const { return _parent; }
|
||||||
|
|
||||||
~VBAPSpeakers ();
|
~VBAPSpeakers ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const double MIN_VOL_P_SIDE_LGTH = 0.01;
|
static const double MIN_VOL_P_SIDE_LGTH = 0.01;
|
||||||
int _dimension;
|
int _dimension;
|
||||||
boost::shared_ptr<Speakers> parent;
|
boost::shared_ptr<Speakers> _parent;
|
||||||
std::vector<Speaker> _speakers;
|
std::vector<Speaker> _speakers;
|
||||||
PBD::ScopedConnection speaker_connection;
|
PBD::ScopedConnection speaker_connection;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue