Sanitize "well-known" ctrl API

This commit is contained in:
Robin Gareus 2017-05-14 00:16:02 +02:00
parent 3e2004aa73
commit 3d26a29e8a
9 changed files with 83 additions and 69 deletions

View File

@ -504,16 +504,16 @@ public:
*/
uint32_t eq_band_cnt () const;
std::string eq_band_name (uint32_t) const;
boost::shared_ptr<AutomationControl> eq_enable_controllable () const;
boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t band) const;
boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t band) const;
boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t band) const;
boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t band) const;
boost::shared_ptr<AutomationControl> eq_enable_controllable () const;
boost::shared_ptr<AutomationControl> eq_hpf_controllable () const;
//additional filter params (currently 32C only )
boost::shared_ptr<AutomationControl> eq_lpf_controllable () const;
boost::shared_ptr<AutomationControl> filter_enable_controllable () const;
//additional HP/LP filters
boost::shared_ptr<AutomationControl> filter_freq_controllable (bool hpf) const;
boost::shared_ptr<AutomationControl> filter_slope_controllable (bool) const;
boost::shared_ptr<AutomationControl> filter_enable_controllable (bool) const;
/* "well-known" controls for a compressor in this route. Any or all may

View File

@ -134,17 +134,16 @@ class LIBARDOUR_API Stripable : public SessionObject,
* return of a null ptr (or an empty string for eq_band_name()).
*/
virtual uint32_t eq_band_cnt () const = 0;
virtual boost::shared_ptr<AutomationControl> eq_enable_controllable () const = 0;
virtual std::string eq_band_name (uint32_t) const = 0;
virtual boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t band) const = 0;
virtual boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t band) const = 0;
virtual boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t band) const = 0;
virtual boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t band) const = 0;
virtual boost::shared_ptr<AutomationControl> eq_enable_controllable () const = 0;
virtual boost::shared_ptr<AutomationControl> eq_hpf_controllable () const = 0;
//additional filter params (currently 32C only )
virtual boost::shared_ptr<AutomationControl> eq_lpf_controllable () const = 0;
virtual boost::shared_ptr<AutomationControl> filter_enable_controllable () const = 0;
virtual boost::shared_ptr<AutomationControl> filter_freq_controllable (bool hp /* false for LPF*/) const = 0;
virtual boost::shared_ptr<AutomationControl> filter_slope_controllable (bool hp) const = 0;
virtual boost::shared_ptr<AutomationControl> filter_enable_controllable (bool hp) const = 0;
/* "well-known" controls for a compressor in this route. Any or all may
* be null.

View File

@ -119,12 +119,14 @@ class LIBARDOUR_API VCA : public Stripable,
boost::shared_ptr<AutomationControl> pan_lfe_control() const { return boost::shared_ptr<AutomationControl>(); }
uint32_t eq_band_cnt () const { return 0; }
std::string eq_band_name (uint32_t) const { return std::string(); }
boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t band) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t band) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t band) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t band) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> eq_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> eq_hpf_controllable () const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> filter_freq_controllable (bool) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> filter_slope_controllable (bool) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> filter_enable_controllable (bool) const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> comp_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> comp_threshold_controllable () const { return boost::shared_ptr<AutomationControl>(); }
boost::shared_ptr<AutomationControl> comp_speed_controllable () const { return boost::shared_ptr<AutomationControl>(); }

View File

@ -976,13 +976,15 @@ LuaBindings::common (lua_State* L)
.addFunction ("comp_mode_name", &Stripable::comp_mode_name)
.addFunction ("comp_speed_name", &Stripable::comp_speed_name)
.addFunction ("eq_band_cnt ", &Stripable::eq_band_cnt)
.addFunction ("eq_enable_control ", &Stripable::eq_enable_controllable )
.addFunction ("eq_band_name", &Stripable::eq_band_name)
.addFunction ("eq_gain_control", &Stripable::eq_gain_controllable)
.addFunction ("eq_freq_control ", &Stripable::eq_freq_controllable )
.addFunction ("eq_q_control ", &Stripable::eq_q_controllable )
.addFunction ("eq_shape_control ", &Stripable::eq_shape_controllable )
.addFunction ("eq_enable_control ", &Stripable::eq_enable_controllable )
.addFunction ("eq_hpf_control ", &Stripable::eq_hpf_controllable )
.addFunction ("filter_freq_controllable ", &Stripable::filter_freq_controllable )
.addFunction ("filter_slope_controllable ", &Stripable::filter_slope_controllable )
.addFunction ("filter_enable_controllable ", &Stripable::filter_enable_controllable )
.addFunction ("set_presentation_order", &Stripable::set_presentation_order)
.addFunction ("presentation_info_ptr", &Stripable::presentation_info_ptr)

View File

@ -4968,7 +4968,7 @@ Route::eq_band_cnt () const
if (is_master() || mixbus()) {
return 3;
} else {
return 6;
return 4;
}
#else
return 3;
@ -5001,10 +5001,10 @@ Route::eq_gain_controllable (uint32_t band) const
} else {
#ifdef MIXBUS32C
switch (band) {
case 2: port_number = 14; break;
case 3: port_number = 12; break;
case 4: port_number = 10; break;
case 5: port_number = 8; break;
case 0: port_number = 14; break;
case 1: port_number = 12; break;
case 2: port_number = 10; break;
case 3: port_number = 8; break;
default:
return boost::shared_ptr<AutomationControl>();
}
@ -5042,12 +5042,10 @@ Route::eq_freq_controllable (uint32_t band) const
uint32_t port_number;
#ifdef MIXBUS32C
switch (band) {
case 0: port_number = 5; break; // HPF
case 1: port_number = 6; break; // LPF
case 2: port_number = 13; break; // lo
case 3: port_number = 11; break; // lo mid
case 4: port_number = 9; break; // hi mid
case 5: port_number = 7; break; // hi
case 0: port_number = 13; break; // lo
case 1: port_number = 11; break; // lo mid
case 2: port_number = 9; break; // hi mid
case 3: port_number = 7; break; // hi
default:
return boost::shared_ptr<AutomationControl>();
}
@ -5076,6 +5074,22 @@ Route::eq_q_controllable (uint32_t band) const
boost::shared_ptr<AutomationControl>
Route::eq_shape_controllable (uint32_t band) const
{
#ifdef MIXBUS32C
boost::shared_ptr<PluginInsert> eq = ch_eq();
if (is_master() || mixbus() || !eq) {
return boost::shared_ptr<AutomationControl>();
}
switch (band) {
case 0:
return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 4))); // lo bell
break;
case 3:
return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 3))); // hi bell
break;
default:
break;
}
#endif
return boost::shared_ptr<AutomationControl>();
}
@ -5096,7 +5110,7 @@ Route::eq_enable_controllable () const
}
boost::shared_ptr<AutomationControl>
Route::eq_hpf_controllable () const
Route::filter_freq_controllable (bool hpf) const
{
#ifdef MIXBUS
boost::shared_ptr<PluginInsert> eq = ch_eq();
@ -5104,35 +5118,33 @@ Route::eq_hpf_controllable () const
if (is_master() || mixbus() || !eq) {
return boost::shared_ptr<AutomationControl>();
}
if (hpf) {
#ifdef MIXBUS32C
return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 5)));
return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 5))); // HPF freq
#else
return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 2)));
return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 2)));
#endif
#else
return boost::shared_ptr<AutomationControl>();
#endif
}
boost::shared_ptr<AutomationControl>
Route::eq_lpf_controllable () const
{
} else {
#ifdef MIXBUS32C
boost::shared_ptr<PluginInsert> eq = ch_eq();
if (is_master() || mixbus() || !eq) {
return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 6))); // LPF freq
#else
return boost::shared_ptr<AutomationControl>();
#endif
}
return boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 4)));
#else
return boost::shared_ptr<AutomationControl>();
#endif
}
boost::shared_ptr<AutomationControl>
Route::filter_enable_controllable () const
Route::filter_slope_controllable (bool) const
{
return boost::shared_ptr<AutomationControl>();
}
boost::shared_ptr<AutomationControl>
Route::filter_enable_controllable (bool) const
{
#ifdef MIXBUS32C
boost::shared_ptr<PluginInsert> eq = ch_eq();
@ -5166,12 +5178,10 @@ Route::eq_band_name (uint32_t band) const
#ifdef MIXBUS32C
} else {
switch (band) {
case 0: return _("HPF");
case 1: return _("LPF");
case 2: return _("lo");
case 3: return _("lo mid");
case 4: return _("hi mid");
case 5: return _("hi");
case 0: return _("lo");
case 1: return _("lo mid");
case 2: return _("hi mid");
case 3: return _("hi");
default: return string();
}
}

View File

@ -1064,13 +1064,13 @@ FaderPort8::build_well_known_processor_ctrls (boost::shared_ptr<Stripable> s, bo
int cnt = s->eq_band_cnt();
#ifdef MIXBUS32C
PUSH_BACK_NON_NULL ("Flt In", s->filter_enable_controllable ());
PUSH_BACK_NON_NULL ("HP Freq", s->eq_hpf_controllable ());
PUSH_BACK_NON_NULL ("LP Freq", s->eq_lpf_controllable ());
PUSH_BACK_NON_NULL ("Flt In", s->filter_enable_controllable (true)); // both HP/LP
PUSH_BACK_NON_NULL ("HP Freq", s->filter_freq_controllable (true));
PUSH_BACK_NON_NULL ("LP Freq", s->filter_freq_controllable (false));
PUSH_BACK_NON_NULL ("EQ In", s->eq_enable_controllable ());
#elif defined (MIXBUS)
PUSH_BACK_NON_NULL ("EQ In", s->eq_enable_controllable ());
PUSH_BACK_NON_NULL ("HP Freq", s->eq_hpf_controllable ());
PUSH_BACK_NON_NULL ("HP Freq", s->filter_freq_controllable (true));
#endif
for (int band = 0; band < cnt; ++band) {

View File

@ -529,7 +529,7 @@ Strip::notify_eq_change (AutomationType type, uint32_t band, bool force_update)
break;
#ifndef MIXBUS32C
case EQHPF:
control = r->eq_hpf_controllable ();
control = r->filter_freq_controllable (true);
break;
#endif
default:
@ -581,13 +581,13 @@ Strip::notify_dyn_change (AutomationType type, bool force_update, bool propagate
break;
#ifdef MIXBUS32C
case EQHPF:
control = r->eq_hpf_controllable ();
control = r->filter_freq_controllable (true);
break;
case EQLPF:
control = r->eq_lpf_controllable ();
control = r->filter_freq_controllable (false);
break;
case EQFilterEnable:
control = r->filter_enable_controllable ();
control = r->filter_enable_controllable (true); // both HP/LP
break;
#endif
default:
@ -1546,9 +1546,9 @@ Strip::setup_dyn_vpot (boost::shared_ptr<Stripable> r)
boost::shared_ptr<AutomationControl> ec = r->comp_enable_controllable ();
#ifdef MIXBUS32C //Mixbus32C needs to spill the filter controls into the comp section
boost::shared_ptr<AutomationControl> hpfc = r->eq_hpf_controllable ();
boost::shared_ptr<AutomationControl> lpfc = r->eq_lpf_controllable ();
boost::shared_ptr<AutomationControl> fec = r->filter_enable_controllable ();
boost::shared_ptr<AutomationControl> hpfc = r->filter_freq_controllable (true);
boost::shared_ptr<AutomationControl> lpfc = r->filter_freq_controllable (false);
boost::shared_ptr<AutomationControl> fec = r->filter_enable_controllable (true); // shared HP/LP
#endif
uint32_t pos = _surface->mcp().global_index (*this);
@ -1731,7 +1731,7 @@ Strip::setup_eq_vpot (boost::shared_ptr<Stripable> r)
switch (parameter) {
#ifndef MIXBUS32C
case 0: /* first control after band parameters */
pc = r->eq_hpf_controllable();
pc = r->filter_freq_controllable(true);
param = EQHPF;
break;
case 1: /* second control after band parameters */

View File

@ -3706,8 +3706,8 @@ OSC::sel_eq_hpf (float val, lo_message msg)
s = _select;
}
if (s) {
if (s->eq_hpf_controllable()) {
s->eq_hpf_controllable()->set_value (s->eq_hpf_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
if (s->filter_freq_controllable(true)) {
s->filter_freq_controllable(true)->set_value (s->filter_freq_controllable(true)->interface_to_internal (val), PBD::Controllable::NoGroup);
return 0;
}
}

View File

@ -624,10 +624,11 @@ void
OSCSelectObserver::eq_init()
{
// HPF and enable are special case, rest are in bands
if (_strip->eq_hpf_controllable ()) {
_strip->eq_hpf_controllable ()->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/eq_hpf"), _strip->eq_hpf_controllable()), OSC::instance());
change_message ("/select/eq_hpf", _strip->eq_hpf_controllable());
if (_strip->filter_freq_controllable (true)) {
_strip->filter_freq_controllable (true)->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/eq_hpf"), _strip->filter_freq_controllable (true)), OSC::instance());
change_message ("/select/eq_hpf", _strip->filter_freq_controllable(true));
}
// TODO LPF and LPF/HPF enable ctrls.
if (_strip->eq_enable_controllable ()) {
_strip->eq_enable_controllable ()->Changed.connect (eq_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::enable_message, this, X_("/select/eq_enable"), _strip->eq_enable_controllable()), OSC::instance());
enable_message ("/select/eq_enable", _strip->eq_enable_controllable());
@ -666,7 +667,7 @@ OSCSelectObserver::eq_end ()
{
//need to check feedback for [13]
eq_connections.drop_connections ();
if (_strip->eq_hpf_controllable ()) {
if (_strip->filter_freq_controllable (true)) {
send_float ("/select/eq_hpf", 0);
}
if (_strip->eq_enable_controllable ()) {