Make master-output-volume optional

This commit is contained in:
Robin Gareus 2020-07-21 05:50:12 +02:00
parent 2829ba5150
commit 4dffe6e26e
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
3 changed files with 12 additions and 2 deletions

View file

@ -133,6 +133,7 @@ CONFIG_VARIABLE (bool, all_safe, "all-safe", false)
CONFIG_VARIABLE (bool, show_solo_mutes, "show-solo-mutes", true)
CONFIG_VARIABLE (bool, solo_mute_override, "solo-mute-override", false)
CONFIG_VARIABLE (bool, auto_input_does_talkback, "auto-input-does-talkback", false)
CONFIG_VARIABLE (bool, use_master_volume, "use-master-volume", false)
CONFIG_VARIABLE (gain_t, solo_mute_gain, "solo-mute-gain", 0.0)
CONFIG_VARIABLE (std::string, monitor_bus_preferred_bundle, "monitor-bus-preferred-bundle", "")
CONFIG_VARIABLE (bool, quieten_at_speed, "quieten-at-speed", true)

View file

@ -256,9 +256,10 @@ Route::init ()
if (is_master()) {
_volume_control.reset (new GainControl (_session, MainOutVolume));
_volume_control->set_flag (Controllable::NotAutomatable);
//add_control (_volume_control);
if (Config->get_use_master_volume ()) {
_main_outs->add_gain (_volume_control);
}
}
_main_outs->activate ();
if (is_monitor()) {

View file

@ -4236,6 +4236,14 @@ Session::config_changed (std::string p, bool ours)
} else if (p == "loop-fade-choice") {
last_loopend = 0; /* force locate to refill buffers with new loop boundary data */
auto_loop_changed (_locations->auto_loop_location());
} else if (p == "use-master-volume") {
if (master_volume ()) {
bool en = Config->get_use_master_volume ();
_master_out->main_outs()->add_gain (en ? master_volume () : boost::shared_ptr<GainControl> ());
if (!en) {
master_volume ()->set_value (GAIN_COEFF_UNITY, Controllable::NoGroup);
}
}
}
set_dirty ();