Special-case VCA at 0 (-inf dB), force gain slaves to -inf dB
This commit is contained in:
parent
e0a1c7690a
commit
22bddf5434
@ -51,6 +51,7 @@ class LIBARDOUR_API GainControl : public SlavableAutomationControl {
|
||||
void inc_gain (gain_t);
|
||||
|
||||
protected:
|
||||
void post_add_master (boost::shared_ptr<AutomationControl>);
|
||||
bool get_masters_curve_locked (framepos_t, framepos_t, float*, framecnt_t) const;
|
||||
};
|
||||
|
||||
|
@ -99,9 +99,9 @@ protected:
|
||||
|
||||
double val_ctrl () const { return _val_ctrl; }
|
||||
double val_master () const { return _val_master; }
|
||||
double val_master_inv () const { return _val_master == 0 ? 1.0 : 1.0 / _val_master; }
|
||||
|
||||
double master_ratio () const { return _val_master == 0 ? master()->get_value() : master()->get_value() / _val_master; }
|
||||
double val_master_inv () const { return _val_master == 0 ? 0 : 1.0 / _val_master; }
|
||||
double master_ratio () const { return _val_master == 0 ? 0 : master()->get_value() / _val_master; }
|
||||
|
||||
int set_state (XMLNode const&, int);
|
||||
|
||||
|
@ -102,6 +102,15 @@ GainControl::inc_gain (gain_t factor)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GainControl::post_add_master (boost::shared_ptr<AutomationControl> m)
|
||||
{
|
||||
if (m->get_value() == 0) {
|
||||
/* master is at -inf, which forces this ctrl to -inf on assignment */
|
||||
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
GainControl::get_masters_curve_locked (framepos_t start, framepos_t end, float* vec, framecnt_t veclen) const
|
||||
{
|
||||
|
@ -150,9 +150,7 @@ SlavableAutomationControl::masters_curve_multiply (framepos_t start, framepos_t
|
||||
= boost::dynamic_pointer_cast<SlavableAutomationControl>(mr->second.master());
|
||||
assert (sc);
|
||||
rv |= sc->masters_curve_multiply (start, end, vec, veclen);
|
||||
if (mr->second.val_master () != 0) {
|
||||
apply_gain_to_buffer (vec, veclen, 1.f / mr->second.val_master ());
|
||||
}
|
||||
apply_gain_to_buffer (vec, veclen, mr->second.val_master_inv ());
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -166,7 +164,7 @@ SlavableAutomationControl::reduce_by_masters_locked (double value, bool ignore_a
|
||||
/* need to scale given value by current master's scaling */
|
||||
const double masters_value = get_masters_value_locked();
|
||||
if (masters_value == 0.0) {
|
||||
value = 0.0; // XXX 1.0, see master_ratio(), val_master_inv()
|
||||
value = 0.0;
|
||||
} else {
|
||||
value /= masters_value;
|
||||
value = std::max (lower(), std::min(upper(), value));
|
||||
|
Loading…
Reference in New Issue
Block a user