13
0

Constrain gain-control range (notably trim)

This commit is contained in:
Robin Gareus 2024-06-20 01:01:11 +02:00
parent cce6aba35d
commit d2fdd72bc4
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 12 additions and 0 deletions

View File

@ -44,6 +44,7 @@ class LIBARDOUR_API GainControl : public SlavableAutomationControl {
protected:
void post_add_master (std::shared_ptr<AutomationControl>);
bool get_masters_curve_locked (samplepos_t, samplepos_t, float*, samplecnt_t) const;
void actually_set_value (double value, PBD::Controllable::GroupControlDisposition);
};
} /* namespace */

View File

@ -107,6 +107,17 @@ GainControl::inc_gain (gain_t factor)
}
}
void
GainControl::actually_set_value (double value, PBD::Controllable::GroupControlDisposition gcd)
{
const double max_factor = _desc.from_interface (1.0);
const double min_factor = _desc.from_interface (0.0);
value = std::max (min_factor, std::min (value, max_factor));
SlavableAutomationControl::actually_set_value (value, gcd);
}
void
GainControl::post_add_master (std::shared_ptr<AutomationControl> m)
{