Pan: consolidate what_can_be_automated API

This commit is contained in:
Robin Gareus 2020-03-21 03:43:21 +01:00
parent 60bcefd03d
commit 386264bd23
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
15 changed files with 43 additions and 63 deletions

View file

@ -256,7 +256,7 @@ Panner2d::handle_state_change ()
panner_shell->panner()->SignalPositionChanged.connect (panner_connections, invalidator(*this), boost::bind (&Panner2d::handle_position_change, this), gui_context()); panner_shell->panner()->SignalPositionChanged.connect (panner_connections, invalidator(*this), boost::bind (&Panner2d::handle_position_change, this), gui_context());
set<Evoral::Parameter> params = panner_shell->panner()->what_can_be_automated(); set<Evoral::Parameter> params = panner_shell->pannable()->what_can_be_automated();
set<Evoral::Parameter>::iterator p = params.find(PanElevationAutomation); set<Evoral::Parameter>::iterator p = params.find(PanElevationAutomation);
bool elev = have_elevation; bool elev = have_elevation;
have_elevation = (p == params.end()) ? false : true; have_elevation = (p == params.end()) ? false : true;
@ -997,7 +997,7 @@ Panner2dWindow::set_bypassed ()
bypass_button.set_active(model); bypass_button.set_active(model);
} }
set<Evoral::Parameter> params = widget.get_panner_shell()->panner()->what_can_be_automated(); set<Evoral::Parameter> params = widget.get_panner_shell()->pannable()->what_can_be_automated();
set<Evoral::Parameter>::iterator p = params.find(PanWidthAutomation); set<Evoral::Parameter>::iterator p = params.find(PanWidthAutomation);
if (p == params.end()) { if (p == params.end()) {
spinner_box.set_sensitive(false); spinner_box.set_sensitive(false);

View file

@ -1814,7 +1814,7 @@ RouteTimeAxisView::ensure_pan_views (bool show)
return; return;
} }
set<Evoral::Parameter> params = _route->panner()->what_can_be_automated(); set<Evoral::Parameter> params = _route->pannable()->what_can_be_automated();
set<Evoral::Parameter>::iterator p; set<Evoral::Parameter>::iterator p;
for (p = params.begin(); p != params.end(); ++p) { for (p = params.begin(); p != params.end(); ++p) {

View file

@ -53,6 +53,8 @@ public:
Session& session() { return _session; } Session& session() { return _session; }
const std::set<Evoral::Parameter>& what_can_be_automated() const;
void set_automation_state (AutoState); void set_automation_state (AutoState);
AutoState automation_state() const { return _auto_state; } AutoState automation_state() const { return _auto_state; }
PBD::Signal1<void, AutoState> automation_state_changed; PBD::Signal1<void, AutoState> automation_state_changed;

View file

@ -110,8 +110,6 @@ public:
void set_automation_state (AutoState); void set_automation_state (AutoState);
AutoState automation_state() const; AutoState automation_state() const;
virtual std::set<Evoral::Parameter> what_can_be_automated() const;
bool touching() const; bool touching() const;
/** /**
@ -145,8 +143,16 @@ public:
protected: protected:
friend PanControllable; friend PanControllable;
friend Pannable; // allow what_can_be_automated
boost::shared_ptr<Pannable> _pannable; boost::shared_ptr<Pannable> _pannable;
std::set<Evoral::Parameter> _can_automate_list;
const std::set<Evoral::Parameter>& what_can_be_automated() const {
return _can_automate_list;
}
virtual std::string value_as_string (boost::shared_ptr<const AutomationControl>) const = 0; virtual std::string value_as_string (boost::shared_ptr<const AutomationControl>) const = 0;
virtual void distribute_one (AudioBuffer&, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which) = 0; virtual void distribute_one (AudioBuffer&, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which) = 0;

View file

@ -108,6 +108,16 @@ Pannable::set_panner (boost::shared_ptr<Panner> p)
_panner = p; _panner = p;
} }
const std::set<Evoral::Parameter>&
Pannable::what_can_be_automated() const
{
boost::shared_ptr<Panner> const panner = _panner.lock();
if (panner) {
return panner->what_can_be_automated ();
}
return Automatable::what_can_be_automated ();
}
void void
Pannable::value_changed () Pannable::value_changed ()
{ {

View file

@ -86,12 +86,6 @@ Panner::touching () const
return _pannable->touching (); return _pannable->touching ();
} }
set<Evoral::Parameter>
Panner::what_can_be_automated() const
{
return _pannable->what_can_be_automated ();
}
int int
Panner::set_state (XMLNode const &, int) Panner::set_state (XMLNode const &, int)
{ {

View file

@ -5367,7 +5367,7 @@ Route::pan_elevation_control() const
return boost::shared_ptr<AutomationControl>(); return boost::shared_ptr<AutomationControl>();
} }
set<Evoral::Parameter> c = panner()->what_can_be_automated (); set<Evoral::Parameter> c = pannable()->what_can_be_automated ();
if (c.find (PanElevationAutomation) != c.end()) { if (c.find (PanElevationAutomation) != c.end()) {
return _pannable->pan_elevation_control; return _pannable->pan_elevation_control;
@ -5388,7 +5388,7 @@ Route::pan_width_control() const
return boost::shared_ptr<AutomationControl>(); return boost::shared_ptr<AutomationControl>();
} }
set<Evoral::Parameter> c = panner()->what_can_be_automated (); set<Evoral::Parameter> c = pannable()->what_can_be_automated ();
if (c.find (PanWidthAutomation) != c.end()) { if (c.find (PanWidthAutomation) != c.end()) {
return _pannable->pan_width_control; return _pannable->pan_width_control;
@ -5403,7 +5403,7 @@ Route::pan_frontback_control() const
return boost::shared_ptr<AutomationControl>(); return boost::shared_ptr<AutomationControl>();
} }
set<Evoral::Parameter> c = panner()->what_can_be_automated (); set<Evoral::Parameter> c = pannable()->what_can_be_automated ();
if (c.find (PanFrontBackAutomation) != c.end()) { if (c.find (PanFrontBackAutomation) != c.end()) {
return _pannable->pan_frontback_control; return _pannable->pan_frontback_control;
@ -5418,7 +5418,7 @@ Route::pan_lfe_control() const
return boost::shared_ptr<AutomationControl>(); return boost::shared_ptr<AutomationControl>();
} }
set<Evoral::Parameter> c = panner()->what_can_be_automated (); set<Evoral::Parameter> c = pannable()->what_can_be_automated ();
if (c.find (PanLFEAutomation) != c.end()) { if (c.find (PanLFEAutomation) != c.end()) {
return _pannable->pan_lfe_control; return _pannable->pan_lfe_control;

View file

@ -80,6 +80,8 @@ Panner1in2out::Panner1in2out (boost::shared_ptr<Pannable> p)
_pannable->pan_azimuth_control->set_value (0.5, Controllable::NoGroup); _pannable->pan_azimuth_control->set_value (0.5, Controllable::NoGroup);
} }
_can_automate_list.insert (Evoral::Parameter (PanAzimuthAutomation));
update (); update ();
left = desired_left; left = desired_left;
@ -342,15 +344,6 @@ Panner1in2out::get_state ()
return root; return root;
} }
std::set<Evoral::Parameter>
Panner1in2out::what_can_be_automated() const
{
set<Evoral::Parameter> s;
s.insert (Evoral::Parameter (PanAzimuthAutomation));
return s;
}
string string
Panner1in2out::value_as_string (boost::shared_ptr<const AutomationControl> ac) const Panner1in2out::value_as_string (boost::shared_ptr<const AutomationControl> ac) const
{ {

View file

@ -52,8 +52,6 @@ class Panner1in2out : public Panner
ChanCount in() const { return ChanCount (DataType::AUDIO, 1); } ChanCount in() const { return ChanCount (DataType::AUDIO, 1); }
ChanCount out() const { return ChanCount (DataType::AUDIO, 2); } ChanCount out() const { return ChanCount (DataType::AUDIO, 2); }
std::set<Evoral::Parameter> what_can_be_automated() const;
static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>); static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
std::string value_as_string (boost::shared_ptr<const AutomationControl>) const; std::string value_as_string (boost::shared_ptr<const AutomationControl>) const;

View file

@ -85,6 +85,8 @@ Panner2in2out::Panner2in2out (boost::shared_ptr<Pannable> p)
set_width(w > 0 ? wrange : -wrange); set_width(w > 0 ? wrange : -wrange);
} }
_can_automate_list.insert (Evoral::Parameter (PanAzimuthAutomation));
_can_automate_list.insert (Evoral::Parameter (PanWidthAutomation));
update (); update ();
@ -486,15 +488,6 @@ Panner2in2out::get_state ()
return root; return root;
} }
std::set<Evoral::Parameter>
Panner2in2out::what_can_be_automated() const
{
set<Evoral::Parameter> s;
s.insert (Evoral::Parameter (PanAzimuthAutomation));
s.insert (Evoral::Parameter (PanWidthAutomation));
return s;
}
string string
Panner2in2out::value_as_string (boost::shared_ptr<const AutomationControl> ac) const Panner2in2out::value_as_string (boost::shared_ptr<const AutomationControl> ac) const
{ {

View file

@ -58,8 +58,6 @@ class Panner2in2out : public Panner
double position () const; double position () const;
double width () const; double width () const;
std::set<Evoral::Parameter> what_can_be_automated() const;
static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>); static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
std::string value_as_string (boost::shared_ptr<const AutomationControl>) const; std::string value_as_string (boost::shared_ptr<const AutomationControl>) const;

View file

@ -77,6 +77,8 @@ Pannerbalance::Pannerbalance (boost::shared_ptr<Pannable> p)
_pannable->pan_azimuth_control->set_value (0.5, Controllable::NoGroup); _pannable->pan_azimuth_control->set_value (0.5, Controllable::NoGroup);
} }
_can_automate_list.insert (Evoral::Parameter (PanAzimuthAutomation));
update (); update ();
/* LEFT SIGNAL */ /* LEFT SIGNAL */
@ -275,14 +277,6 @@ Pannerbalance::get_state ()
return root; return root;
} }
std::set<Evoral::Parameter>
Pannerbalance::what_can_be_automated() const
{
set<Evoral::Parameter> s;
s.insert (Evoral::Parameter (PanAzimuthAutomation));
return s;
}
string string
Pannerbalance::value_as_string (boost::shared_ptr<const AutomationControl> ac) const Pannerbalance::value_as_string (boost::shared_ptr<const AutomationControl> ac) const
{ {

View file

@ -50,8 +50,6 @@ class Pannerbalance : public Panner
std::pair<double, double> position_range () const; std::pair<double, double> position_range () const;
double position () const; double position () const;
std::set<Evoral::Parameter> what_can_be_automated() const;
static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>); static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
std::string value_as_string (boost::shared_ptr<const AutomationControl>) const; std::string value_as_string (boost::shared_ptr<const AutomationControl>) const;

View file

@ -123,6 +123,16 @@ VBAPanner::configure_io (ChanCount in, ChanCount /* ignored - we use Speakers */
void void
VBAPanner::update () VBAPanner::update ()
{ {
_can_automate_list.clear ();
_can_automate_list.insert (Evoral::Parameter (PanAzimuthAutomation));
if (_signals.size() > 1) {
_can_automate_list.insert (Evoral::Parameter (PanWidthAutomation));
}
if (_speakers->dimension() == 3) {
_can_automate_list.insert (Evoral::Parameter (PanElevationAutomation));
}
/* recompute signal directions based on panner azimuth and, if relevant, width (diffusion) and elevation parameters */ /* recompute signal directions based on panner azimuth and, if relevant, width (diffusion) and elevation parameters */
double elevation = _pannable->pan_elevation_control->get_value() * 90.0; double elevation = _pannable->pan_elevation_control->get_value() * 90.0;
@ -392,20 +402,6 @@ VBAPanner::out() const
return ChanCount (DataType::AUDIO, _speakers->n_speakers()); return ChanCount (DataType::AUDIO, _speakers->n_speakers());
} }
std::set<Evoral::Parameter>
VBAPanner::what_can_be_automated() const
{
set<Evoral::Parameter> s;
s.insert (Evoral::Parameter (PanAzimuthAutomation));
if (_signals.size() > 1) {
s.insert (Evoral::Parameter (PanWidthAutomation));
}
if (_speakers->dimension() == 3) {
s.insert (Evoral::Parameter (PanElevationAutomation));
}
return s;
}
string string
VBAPanner::value_as_string (boost::shared_ptr<const AutomationControl> ac) const VBAPanner::value_as_string (boost::shared_ptr<const AutomationControl> ac) const
{ {

View file

@ -49,8 +49,6 @@ public:
void set_width (double); void set_width (double);
void set_elevation (double); void set_elevation (double);
std::set<Evoral::Parameter> what_can_be_automated() const;
static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>); static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
void distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes); void distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes);