diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 2d371122f3..6a5652b5ec 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -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 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); }; diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index abd84a747a..8dcedc4e1f 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -192,7 +192,8 @@ Delivery::can_support_io_configuration (const ChanCount& in, ChanCount& out) } void -Delivery::set_gain_control (std::shared_ptr gc) { +Delivery::set_gain_control (std::shared_ptr gc) +{ if (gc) { _gain_control = gc; _amp.reset (new Amp (_session, _("Fader"), _gain_control, true)); diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 1c38c3799b..d944d1d2ea 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -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 diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index c9b266de94..d9303948a7 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -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 rl = routes.reader (); + std::shared_ptr master_sends (new AutomationControlList); + std::shared_ptr 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 */ +}