From 384739aa80f451ab4bee69dc94ac9a06ea054f31 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 10 May 2024 15:15:32 -0600 Subject: [PATCH 1/2] Revert "fix for metering of a MasterSend (internal send)" MasterSends are not (currently) part of Ardour. This reverts commit de1a425704960175a6458a6da9ef65f5ef0d4f59. --- libs/ardour/internal_send.cc | 93 ++++++++++-------------------------- 1 file changed, 25 insertions(+), 68 deletions(-) diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index 94a1e4f755..1e1511c5fc 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -229,34 +229,29 @@ InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa _panshell->run (bufs, mixbufs, start_sample + latency, end_sample + latency, nframes); } - /* No need to handle non-audio if this is the MasterSend */ + /* non-audio data will not have been copied by the panner, do it now + * if there are more buffers available than send buffers, ignore them, + * if there are less, copy the last as IO::copy_to_output does. */ - if (role() != MasterSend) { + for (DataType::iterator t = DataType::begin (); t != DataType::end (); ++t) { + if (*t != DataType::AUDIO) { + BufferSet::iterator o = mixbufs.begin (*t); + BufferSet::iterator i = bufs.begin (*t); - /* non-audio data will not have been copied by the panner, do it now - * if there are more buffers available than send buffers, ignore them, - * if there are less, copy the last as IO::copy_to_output does. */ - - for (DataType::iterator t = DataType::begin (); t != DataType::end (); ++t) { - if (*t != DataType::AUDIO) { - BufferSet::iterator o = mixbufs.begin (*t); - BufferSet::iterator i = bufs.begin (*t); - - while (i != bufs.end (*t) && o != mixbufs.end (*t)) { - o->read_from (*i, nframes); - ++i; - ++o; - } - while (o != mixbufs.end (*t)) { - o->silence (nframes, 0); - ++o; - } + while (i != bufs.end (*t) && o != mixbufs.end (*t)) { + o->read_from (*i, nframes); + ++i; + ++o; + } + while (o != mixbufs.end (*t)) { + o->silence (nframes, 0); + ++o; } } } - } else if (role () == Listen || role() == MasterSend) { - /* We're going to the monitor or master bus, so discard MIDI data */ + } else if (role () == Listen) { + /* We're going to the monitor bus, so discard MIDI data */ uint32_t const bufs_audio = bufs.count ().get (DataType::AUDIO); uint32_t const mixbufs_audio = mixbufs.count ().get (DataType::AUDIO); @@ -314,51 +309,15 @@ InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa } } - /* For a master send, we want the meter to be effectively MeterPostFader - * rather than MeterOutput. But below, we compute a target gain that - * will take mute and solo into account, and apply to mixbufs *before* - * metering, which would make metering equivalent to MeterOutput. - * - * So, for a master send, run our own gain control first (so we see the - * effect in the meters), then meter, then apply any mute/solo-driven gain. - * - * For other internal sends, apply mute/solo-controlled gain, then our - * own gain control, then meter. - */ - - if (role() == MasterSend) { - - /* apply fader gain automation before running meter */ - - _amp->set_gain_automation_buffer (_session.send_gain_automation_buffer ()); - _amp->setup_gain_automation (start_sample + latency, end_sample + latency, nframes); - _amp->run (mixbufs, start_sample + latency, end_sample + latency, speed, nframes, true); - - if (_metering) { - if (gain_control ()->get_value () == GAIN_COEFF_ZERO) { - _meter->reset (); - } else { - _meter->run (mixbufs, start_sample, end_sample, speed, nframes, true); - } - } - } - - /* tgain reflects muting and soling */ - + /* main gain control: * mute & bypass/enable */ gain_t tgain = target_gain (); if (tgain != _current_gain) { /* target gain has changed, fade in/out */ _current_gain = Amp::apply_gain (mixbufs, _session.nominal_sample_rate (), nframes, _current_gain, tgain); } else if (tgain == GAIN_COEFF_ZERO) { - /* we were quiet last time, and we're still supposed to be - * quiet. Don't do this for a MasterSend, because its meter is - * effectively MeterPostFader, not MeterOutput, so we don't - * want it to reflect mute/solo-controlled levels. - */ - if (role() != MasterSend || (gain_control()->get_value() == GAIN_COEFF_ZERO)) { - _meter->reset (); - } + /* we were quiet last time, and we're still supposed to be quiet. */ + _meter->reset (); Amp::apply_simple_gain (mixbufs, nframes, GAIN_COEFF_ZERO); return; } else if (tgain != GAIN_COEFF_UNITY) { @@ -366,17 +325,15 @@ InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa Amp::apply_simple_gain (mixbufs, nframes, tgain); } - if (role() != MasterSend) { - /* apply fader gain automation */ - _amp->set_gain_automation_buffer (_session.send_gain_automation_buffer ()); - _amp->setup_gain_automation (start_sample + latency, end_sample + latency, nframes); - _amp->run (mixbufs, start_sample + latency, end_sample + latency, speed, nframes, true); - } + /* apply fader gain automation */ + _amp->set_gain_automation_buffer (_session.send_gain_automation_buffer ()); + _amp->setup_gain_automation (start_sample + latency, end_sample + latency, nframes); + _amp->run (mixbufs, start_sample + latency, end_sample + latency, speed, nframes, true); _send_delay->run (mixbufs, start_sample, end_sample, speed, nframes, true); /* consider metering */ - if (_metering && role() != MasterSend) { + if (_metering) { if (gain_control ()->get_value () == GAIN_COEFF_ZERO) { _meter->reset (); } else { From 2f32a22a4db92f30c60b322ee296fdd87c97fd31 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 10 May 2024 15:16:13 -0600 Subject: [PATCH 2/2] Revert "ensure that the master send is directly before the main outs." MasterSends are not (currently) part of Ardour. This reverts commit dcdcaf4b475e4efb4d62812c52415ba9ea6c6f2c. --- libs/ardour/route.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index e4bf429c96..78b087502f 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -5306,12 +5306,6 @@ Route::setup_invisible_processors () new_processors.insert (meter_point, _meter); } - - if (Profile->get_livetrax() && _master_send) { - assert (!_master_send->display_to_user()); - new_processors.insert (main, _master_send); - } - /* Foldback Sends */ for (ProcessorList::iterator i = foldback_sends.begin(); i != foldback_sends.end(); ++i) {