Add a main-outs volume control and dedicated master-volume

This is intended for loudness normalization - #8318 to add
additional gain as last step.
This commit is contained in:
Robin Gareus 2020-07-20 22:54:54 +02:00
parent ebc8e47a71
commit ba0dac92f2
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 31 additions and 0 deletions

View File

@ -500,6 +500,7 @@ public:
boost::shared_ptr<GainControl> gain_control() const;
boost::shared_ptr<GainControl> trim_control() const;
boost::shared_ptr<GainControl> volume_control() const;
boost::shared_ptr<PhaseControl> phase_control() const;
/**
@ -682,6 +683,7 @@ protected:
boost::shared_ptr<GainControl> _gain_control;
boost::shared_ptr<GainControl> _trim_control;
boost::shared_ptr<GainControl> _volume_control;
boost::shared_ptr<PhaseControl> _phase_control;
boost::shared_ptr<Amp> _amp;
boost::shared_ptr<Amp> _trim;

View File

@ -957,6 +957,7 @@ public:
boost::shared_ptr<Route> monitor_out() const { return _monitor_out; }
boost::shared_ptr<Route> master_out() const { return _master_out; }
boost::shared_ptr<GainControl> master_volume () const;
PresentationInfo::order_t master_order_key () const { return _master_out ? _master_out->presentation_info ().order () : -1; }
bool ensure_stripable_sort_order ();

View File

@ -252,6 +252,13 @@ Route::init ()
}
_main_outs.reset (new Delivery (_session, _output, _pannable, _mute_master, _name, Delivery::Main));
/* master outut volume */
if (is_master()) {
_volume_control.reset (new GainControl (_session, MainOutVolume));
_volume_control->set_flag (Controllable::NotAutomatable);
//add_control (_volume_control);
_main_outs->add_gain (_volume_control);
}
_main_outs->activate ();
if (is_monitor()) {
@ -2524,6 +2531,10 @@ Route::state (bool save_template)
node->add_child_nocopy (_mute_control->get_state ());
node->add_child_nocopy (_phase_control->get_state ());
if (_volume_control) {
node->add_child_nocopy (_volume_control->get_state ());
}
if (!skip_saving_automation) {
node->add_child_nocopy (Automatable::get_automation_xml_state ());
}
@ -2761,6 +2772,8 @@ Route::set_state (const XMLNode& node, int version)
_solo_isolate_control->set_state (*child, version);
} else if (control_name == _mute_control->name()) {
_mute_control->set_state (*child, version);
} else if (_volume_control && control_name == _volume_control->name()) {
_volume_control->set_state (*child, version);
} else if (control_name == _phase_control->name()) {
_phase_control->set_state (*child, version);
} else {
@ -4612,6 +4625,12 @@ Route::trim_control() const
return _trim_control;
}
boost::shared_ptr<GainControl>
Route::volume_control() const
{
return _volume_control;
}
boost::shared_ptr<PhaseControl>
Route::phase_control() const
{

View File

@ -925,6 +925,15 @@ Session::auto_connect_master_bus ()
}
}
boost::shared_ptr<GainControl>
Session::master_volume () const
{
if (_master_out) {
return _master_out->volume_control ();
}
return boost::shared_ptr<GainControl> ();
}
void
Session::remove_monitor_section ()
{