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;
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 */
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)
{
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 */
{
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) {
{
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) {
{
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) {