X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fcontrol_group.cc;h=ea289506a6bfec405c983a11a193100f1b3f76a6;hb=1dfcf07ba9448a0a73f85519f04d9c03b08f5e3e;hp=25f21a8775328595bdd843d2aac38f7b32bdc716;hpb=78ad42fd88791da359640329874e2abf2acbebc9;p=ardour.git diff --git a/libs/ardour/control_group.cc b/libs/ardour/control_group.cc index 25f21a8775..ea289506a6 100644 --- a/libs/ardour/control_group.cc +++ b/libs/ardour/control_group.cc @@ -46,6 +46,12 @@ ControlGroup::set_active (bool yn) _active = yn; } +void +ControlGroup::set_mode (Mode m) +{ + _mode = m; +} + void ControlGroup::clear () { @@ -146,6 +152,16 @@ ControlGroup::add_control (boost::shared_ptr ac) return 0; } +void +ControlGroup::pre_realtime_queue_stuff (double val) +{ + Glib::Threads::RWLock::ReaderLock lm (controls_lock); + + for (ControlMap::iterator c = _controls.begin(); c != _controls.end(); ++c) { + c->second->do_pre_realtime_queue_stuff (val); + } +} + void ControlGroup::set_group_value (boost::shared_ptr control, double val) { @@ -155,10 +171,6 @@ ControlGroup::set_group_value (boost::shared_ptr control, dou control->set_value (val, Controllable::ForGroup); - if (!_active) { - return; - } - /* now propagate across the group */ Glib::Threads::RWLock::ReaderLock lm (controls_lock); @@ -185,6 +197,11 @@ ControlGroup::set_group_value (boost::shared_ptr control, dou /*---- GAIN CONTROL GROUP -----------*/ +GainControlGroup::GainControlGroup () + : ControlGroup (GainAutomation) +{ +} + gain_t GainControlGroup::get_min_factor (gain_t factor) { @@ -235,16 +252,6 @@ GainControlGroup::get_max_factor (gain_t factor) void GainControlGroup::set_group_value (boost::shared_ptr control, double val) { - /* set the primary control */ - - control->set_value (val, Controllable::ForGroup); - - /* now propagate across the group */ - - if (!_active) { - return; - } - Glib::Threads::RWLock::ReaderLock lm (controls_lock); if (_mode & Relative) { @@ -262,8 +269,9 @@ GainControlGroup::set_group_value (boost::shared_ptr control, delta -= usable_gain; - if (delta == 0.0f) + if (delta == 0.0f) { return; + } gain_t factor = delta / usable_gain; @@ -281,6 +289,12 @@ GainControlGroup::set_group_value (boost::shared_ptr control, } } + /* set the primary control */ + + control->set_value (val, Controllable::ForGroup); + + /* now propagate across the group */ + for (ControlMap::iterator c = _controls.begin(); c != _controls.end(); ++c) { if (c->second == control) { continue; @@ -295,10 +309,10 @@ GainControlGroup::set_group_value (boost::shared_ptr control, } else { + /* just set entire group */ + for (ControlMap::iterator c = _controls.begin(); c != _controls.end(); ++c) { - if (c->second != control) { - c->second->set_value (val, Controllable::ForGroup); - } + c->second->set_value (val, Controllable::ForGroup); } } }