13
0

add group disposition argument to Route::set_gain() and use it in various UIs

Executive decisions were necessary in a couple of places about the correct group disposition
behaviour, notably faderport and OSC surfaces
This commit is contained in:
Paul Davis 2016-01-18 10:52:15 -05:00
parent 1948b50a68
commit 64c9198d60
10 changed files with 24 additions and 20 deletions

View File

@ -532,7 +532,7 @@ GainMeterBase::gain_adjusted ()
if (!ignore_toggle) {
if (_route && _route->amp() == _amp) {
_route->set_gain (value, this);
_route->set_gain (value, Controllable::UseGroup);
} else {
_amp->gain_control()->set_value (value, Controllable::NoGroup);
}

View File

@ -176,7 +176,7 @@ printf("setting gain to unity (?)");
BOOST_FOREACH(RouteUI* r, _route_targets) {
boost::shared_ptr<Route> rp = r->route();
if (rp) {
rp->set_gain (1.0, this);
rp->set_gain (1.0, Controllable::NoGroup);
}
}
}

View File

@ -1949,25 +1949,25 @@ RouteUI::parameter_changed (string const & p)
void
RouteUI::step_gain_up ()
{
_route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) + 0.1), this);
_route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) + 0.1), Controllable::UseGroup);
}
void
RouteUI::page_gain_up ()
{
_route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) + 0.5), this);
_route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) + 0.5), Controllable::UseGroup);
}
void
RouteUI::step_gain_down ()
{
_route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) - 0.1), this);
_route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) - 0.1), Controllable::UseGroup);
}
void
RouteUI::page_gain_down ()
{
_route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) - 0.5), this);
_route->set_gain (dB_to_coefficient (accurate_coefficient_to_dB (_route->gain_control()->get_value()) - 0.5), Controllable::UseGroup);
}
void

View File

@ -142,8 +142,8 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
void shift (framepos_t, framecnt_t);
void set_gain (gain_t val, void *src);
void inc_gain (gain_t delta, void *src);
void set_gain (gain_t val, PBD::Controllable::GroupControlDisposition);
void inc_gain (gain_t delta);
void set_trim (gain_t val, void *src);

View File

@ -629,7 +629,7 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
/* reset stuff that has already been accounted for in the freeze process */
set_gain (GAIN_COEFF_UNITY, this);
set_gain (GAIN_COEFF_UNITY, Controllable::NoGroup);
_amp->gain_control()->set_automation_state (Off);
/* XXX need to use _main_outs _panner->set_automation_state (Off); */

View File

@ -387,7 +387,7 @@ Route::ensure_track_or_route_name(string name, Session &session)
}
void
Route::inc_gain (gain_t factor, void *src)
Route::inc_gain (gain_t factor)
{
/* To be used ONLY when doing group-relative gain adjustment, from
* ::set_gain()
@ -404,9 +404,9 @@ Route::inc_gain (gain_t factor, void *src)
}
void
Route::set_gain (gain_t val, void *src)
Route::set_gain (gain_t val, Controllable::GroupControlDisposition group_override)
{
if (src != 0 && _route_group && src != _route_group && _route_group->is_active() && _route_group->is_gain()) {
if (_route_group && (group_override != Controllable::NoGroup) && _route_group->is_active() && _route_group->is_gain()) {
if (_route_group->is_relative()) {
@ -441,11 +441,11 @@ Route::set_gain (gain_t val, void *src)
}
}
_route_group->foreach_route (boost::bind (&Route::inc_gain, _1, factor, _route_group));
_route_group->foreach_route (boost::bind (&Route::inc_gain, _1, factor));
} else {
_route_group->foreach_route (boost::bind (&Route::set_gain, _1, val, _route_group));
_route_group->foreach_route (boost::bind (&Route::set_gain, _1, val, Controllable::NoGroup));
}
return;
@ -3894,14 +3894,14 @@ Route::set_latency_compensation (framecnt_t longest_session_latency)
}
void
Route::set_control (AutomationType type, double val, PBD::Controllable::GroupControlDisposition /*group_override*/)
Route::set_control (AutomationType type, double val, PBD::Controllable::GroupControlDisposition group_override)
{
boost::shared_ptr<RouteList> rl;
switch (type) {
case GainAutomation:
/* route must mediate group control */
set_gain (val, this); /* any "src" argument will do other than our route group */
set_gain (val, group_override);
return;
break;

View File

@ -2880,7 +2880,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
// 0 for Stereo Out mode
// 0 Multi Out mode
if (Config->get_output_auto_connect() & AutoConnectMaster) {
track->set_gain (dB_to_coefficient (0), 0);
track->set_gain (dB_to_coefficient (0), Controllable::NoGroup);
}
}

View File

@ -248,7 +248,7 @@ ControlProtocol::route_set_gain (uint32_t table_index, float gain)
boost::shared_ptr<Route> r = route_table[table_index];
if (r != 0) {
r->set_gain (gain, this);
r->set_gain (gain, Controllable::UseGroup);
}
}

View File

@ -499,7 +499,11 @@ FaderPort::fader_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb)
if (gain) {
int ival = (fader_msb << 7) | fader_lsb;
float val = gain->interface_to_internal (ival/16384.0);
_current_route->set_gain (val, this);
/* even though the faderport only controls a
single route at a time, allow the fader to
modify the group, if appropriate.
*/
_current_route->set_gain (val, Controllable::UseGroup);
}
}
}

View File

@ -1013,7 +1013,7 @@ OSC::route_set_gain_abs (int rid, float level)
boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
if (r) {
r->set_gain (level, this);
r->set_gain (level, PBD::Controllable::NoGroup);
}
return 0;