mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
vca design: gain controls cannot silently "merge" the master(s) value into their own
This commit is contained in:
parent
405f9fc712
commit
8eafe8b804
3 changed files with 22 additions and 25 deletions
|
|
@ -118,7 +118,7 @@ Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/,
|
|||
|
||||
} else { /* manual (scalar) gain */
|
||||
|
||||
gain_t const dg = _gain_control->user_double();
|
||||
gain_t const dg = _gain_control->user_double() * _gain_control->get_master_gain ();
|
||||
|
||||
if (_current_gain != dg) {
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ class LIBARDOUR_API GainControl : public AutomationControl {
|
|||
|
||||
void set_value (double val, PBD::Controllable::GroupControlDisposition group_override);
|
||||
void set_value_unchecked (double);
|
||||
double get_value () const;
|
||||
|
||||
double internal_to_interface (double) const;
|
||||
double interface_to_internal (double) const;
|
||||
|
|
@ -54,18 +53,20 @@ class LIBARDOUR_API GainControl : public AutomationControl {
|
|||
double lower_db;
|
||||
double range_db;
|
||||
|
||||
gain_t get_master_gain () const;
|
||||
void add_master (boost::shared_ptr<GainControl>);
|
||||
void remove_master (boost::shared_ptr<GainControl>);
|
||||
void clear_masters ();
|
||||
|
||||
private:
|
||||
void _set_value (double val, PBD::Controllable::GroupControlDisposition group_override);
|
||||
gain_t get_master_gain () const;
|
||||
|
||||
mutable Glib::Threads::Mutex master_lock;
|
||||
|
||||
typedef std::list<boost::shared_ptr<GainControl> > Masters;
|
||||
Masters _masters;
|
||||
|
||||
gain_t get_master_gain_locked () const;
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
|
|
|||
|
|
@ -36,22 +36,6 @@ GainControl::GainControl (Session& session, const Evoral::Parameter ¶m, boos
|
|||
range_db = accurate_coefficient_to_dB (_desc.upper) - lower_db;
|
||||
}
|
||||
|
||||
double
|
||||
GainControl::get_value() const
|
||||
{
|
||||
Glib::Threads::Mutex::Lock sm (master_lock, Glib::Threads::TRY_LOCK);
|
||||
|
||||
if (sm.locked()) {
|
||||
if (_masters.empty()) {
|
||||
return AutomationControl::get_value();
|
||||
}
|
||||
return AutomationControl::get_value() * get_master_gain ();
|
||||
} else {
|
||||
/* could not take lock */
|
||||
return AutomationControl::get_value ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GainControl::set_value (double val, PBD::Controllable::GroupControlDisposition group_override)
|
||||
{
|
||||
|
|
@ -115,6 +99,18 @@ GainControl::get_user_string () const
|
|||
|
||||
gain_t
|
||||
GainControl::get_master_gain () const
|
||||
{
|
||||
Glib::Threads::Mutex::Lock sm (master_lock, Glib::Threads::TRY_LOCK);
|
||||
|
||||
if (sm.locked()) {
|
||||
return get_master_gain_locked ();
|
||||
}
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
gain_t
|
||||
GainControl::get_master_gain_locked () const
|
||||
{
|
||||
/* Master lock MUST be held */
|
||||
|
||||
|
|
@ -135,9 +131,9 @@ GainControl::add_master (boost::shared_ptr<GainControl> m)
|
|||
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (master_lock);
|
||||
old_master_val = get_master_gain ();
|
||||
old_master_val = get_master_gain_locked ();
|
||||
_masters.push_back (m);
|
||||
new_master_val = get_master_gain ();
|
||||
new_master_val = get_master_gain_locked ();
|
||||
}
|
||||
|
||||
if (old_master_val != new_master_val) {
|
||||
|
|
@ -153,9 +149,9 @@ GainControl::remove_master (boost::shared_ptr<GainControl> m)
|
|||
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (master_lock);
|
||||
old_master_val = get_master_gain ();
|
||||
old_master_val = get_master_gain_locked ();
|
||||
_masters.remove (m);
|
||||
new_master_val = get_master_gain ();
|
||||
new_master_val = get_master_gain_locked ();
|
||||
}
|
||||
|
||||
if (old_master_val != new_master_val) {
|
||||
|
|
@ -171,9 +167,9 @@ GainControl::clear_masters ()
|
|||
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (master_lock);
|
||||
old_master_val = get_master_gain ();
|
||||
old_master_val = get_master_gain_locked ();
|
||||
_masters.clear ();
|
||||
new_master_val = get_master_gain ();
|
||||
new_master_val = get_master_gain_locked ();
|
||||
}
|
||||
|
||||
if (old_master_val != new_master_val) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue