diff options
author | Robin Gareus <robin@gareus.org> | 2017-07-08 15:43:32 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-07-08 15:43:32 +0200 |
commit | 5fc037cbe937113d571ad1427635afd41f8e6f3d (patch) | |
tree | 08f42711b4ad8e84c61064872f60401737430165 /gtk2_ardour | |
parent | 82278af424461a9d966dc886302ceb24e775a32c (diff) |
Fix gain inc/dec with multiple-selection spanning groups
When tracks in a gain-sharing group are selected, stepping gain
up/down affected the tracks N times:
for-each selected track inc/dec gain w/grouping.
When a mix of grouped and un-grouped tracks is selected, this lead to
inconsistent gain changes.
The new approach expands the groups first. Ignoring groups is not correct
either for single selection.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 37 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.h | 1 |
2 files changed, 27 insertions, 11 deletions
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index e8c431041a..c775b9b2b9 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -2983,29 +2983,44 @@ Mixer_UI::rec_enable_action () control_action (&Stripable::rec_enable_control); } -void -Mixer_UI::step_gain_up_action () +AutomationControlSet +Mixer_UI::selected_gaincontrols () { set_axis_targets_for_operation (); - + AutomationControlSet rv; BOOST_FOREACH(AxisView* r, _axis_targets) { MixerStrip* ms = dynamic_cast<MixerStrip*> (r); if (ms) { - ms->step_gain_up (); + boost::shared_ptr<GainControl> ac (ms->route()->gain_control()); + ControlList cl (ac->grouped_controls()); + for (ControlList::const_iterator c = cl.begin(); c != cl.end (); ++c) { + rv.insert (*c); + } + rv.insert (ac); } } + return rv; } void -Mixer_UI::step_gain_down_action () +Mixer_UI::step_gain_up_action () { - set_axis_targets_for_operation (); + AutomationControlSet acs = selected_gaincontrols (); + for (AutomationControlSet::const_iterator i = acs.begin(); i != acs.end (); ++i) { + boost::shared_ptr<GainControl> ac = boost::dynamic_pointer_cast<GainControl> (*i); + assert (ac); + ac->set_value (dB_to_coefficient (accurate_coefficient_to_dB (ac->get_value()) + 0.1), Controllable::NoGroup); + } +} - BOOST_FOREACH(AxisView* r, _axis_targets) { - MixerStrip* ms = dynamic_cast<MixerStrip*> (r); - if (ms) { - ms->step_gain_down (); - } +void +Mixer_UI::step_gain_down_action () +{ + AutomationControlSet acs = selected_gaincontrols (); + for (AutomationControlSet::const_iterator i = acs.begin(); i != acs.end (); ++i) { + boost::shared_ptr<GainControl> ac = boost::dynamic_pointer_cast<GainControl> (*i); + assert (ac); + ac->set_value (dB_to_coefficient (accurate_coefficient_to_dB (ac->get_value()) - 0.1), Controllable::NoGroup); } } diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 27c8f0bce6..24e457cf72 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -129,6 +129,7 @@ public: protected: void set_axis_targets_for_operation (); + ARDOUR::AutomationControlSet selected_gaincontrols (); private: Mixer_UI (); |