libardour infrastructure for virtual soundcheck

This commit is contained in:
Paul Davis 2024-04-04 16:06:13 -06:00
parent dd9ac897e9
commit 155799e25f
4 changed files with 55 additions and 1 deletions

View File

@ -1409,6 +1409,10 @@ public:
void disable_file_format_reset ();
void reset_native_file_format();
void enable_virtual_soundcheck ();
void disable_virtual_soundcheck ();
PBD::Signal1<void,bool> VirtualSoundCheckChanged;
protected:
friend class AudioEngine;
void set_block_size (pframes_t nframes);
@ -2420,6 +2424,8 @@ private:
void time_domain_changed ();
uint32_t _no_file_format_reset;
void set_virtual_soundcheck (bool);
};

View File

@ -192,7 +192,8 @@ Delivery::can_support_io_configuration (const ChanCount& in, ChanCount& out)
}
void
Delivery::set_gain_control (std::shared_ptr<GainControl> gc) {
Delivery::set_gain_control (std::shared_ptr<GainControl> gc)
{
if (gc) {
_gain_control = gc;
_amp.reset (new Amp (_session, _("Fader"), _gain_control, true));

View File

@ -2839,6 +2839,12 @@ Route::set_state (const XMLNode& node, int version)
}
}
if (Profile->get_livetrax() && is_track()) {
_volume_control.reset (new GainControl (_session, MainOutVolume));
_volume_control->set_flag (Controllable::NotAutomatable);
_main_outs->set_gain_control (_volume_control);
}
set_processor_state (processor_state, version);
// this looks up the internal instrument in processors

View File

@ -8238,3 +8238,44 @@ Session::foreach_route (void (Route::*method)())
((r.get())->*method) ();
}
}
void
Session::enable_virtual_soundcheck ()
{
set_virtual_soundcheck (true);
}
void
Session::disable_virtual_soundcheck ()
{
set_virtual_soundcheck (false);
}
void
Session::set_virtual_soundcheck (bool yn)
{
std::shared_ptr<RouteList const> rl = routes.reader ();
std::shared_ptr<AutomationControlList> master_sends (new AutomationControlList);
std::shared_ptr<AutomationControlList> main_outs (new AutomationControlList);
gain_t main_val = (yn ? 1. : 0.);
gain_t send_val = (yn ? 0. : 1.);
for (auto & route : *rl) {
if (!route->is_track()) {
continue;
}
master_sends->push_back (route->master_send()->gain_control());
main_outs->push_back (route->main_outs()->gain_control());
}
if (!master_sends->empty()) {
set_controls (master_sends, send_val, PBD::Controllable::NoGroup);
set_controls (main_outs, main_val, PBD::Controllable::NoGroup);
}
VirtualSoundCheckChanged (yn); /* EMIT SIGNAL */
}