diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-01-22 14:42:25 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-05-31 15:30:38 -0400 |
commit | 87481a2ee17023686991e1a87182c2e8ed335690 (patch) | |
tree | a07bceda3055fc53f36ada8b70bb7d77f4742cac /libs/ardour/gain_control.cc | |
parent | ca8ac0591ffb55a64f05b0d3f506a06f83082909 (diff) |
initially pass at libardour VCA implementation
Diffstat (limited to 'libs/ardour/gain_control.cc')
-rw-r--r-- | libs/ardour/gain_control.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libs/ardour/gain_control.cc b/libs/ardour/gain_control.cc index 867edaf5a3..5af0e2d397 100644 --- a/libs/ardour/gain_control.cc +++ b/libs/ardour/gain_control.cc @@ -36,6 +36,15 @@ GainControl::GainControl (Session& session, const Evoral::Parameter ¶m, boos range_db = accurate_coefficient_to_dB (_desc.upper) - lower_db; } +double +GainControl::get_value() const +{ + if (!_master) { + return AutomationControl::get_value(); + } + return AutomationControl::get_value() * _master->get_value(); +} + void GainControl::set_value (double val, PBD::Controllable::GroupControlDisposition group_override) { @@ -97,3 +106,29 @@ GainControl::get_user_string () const return std::string(theBuf); } +void +GainControl::set_master (boost::shared_ptr<GainControl> m) +{ + double old_master_val; + + if (_master) { + old_master_val = _master->get_value(); + } else { + old_master_val = 1.0; + } + + _master = m; + + double new_master_val; + + if (_master) { + new_master_val = _master->get_value(); + } else { + new_master_val = 1.0; + } + + if (old_master_val != new_master_val) { + Changed(); /* EMIT SIGNAL */ + } +} + |