libardour: use Processor::check_active() in all Processors instead of per-processor code
There are a few exceptions where the semantics make this too complex to be worth forcing check_active()
This commit is contained in:
parent
59ac52f113
commit
83c7ac4f38
|
@ -82,7 +82,7 @@ scale_midi_velocity(Evoral::Event<MidiBuffer::TimeType>& ev, float factor)
|
|||
void
|
||||
Amp::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
|
||||
{
|
||||
if (!_active && !_pending_active) {
|
||||
if (!check_active()) {
|
||||
/* disregard potentially prepared gain-automation. */
|
||||
_apply_gain_automation = false;
|
||||
return;
|
||||
|
@ -155,8 +155,6 @@ Amp::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sampl
|
|||
_current_gain = target_gain;
|
||||
}
|
||||
}
|
||||
|
||||
_active = _pending_active;
|
||||
}
|
||||
|
||||
gain_t
|
||||
|
|
|
@ -241,16 +241,16 @@ Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample
|
|||
{
|
||||
assert (_output);
|
||||
|
||||
if (!check_active()) {
|
||||
_output->silence (nframes);
|
||||
return;
|
||||
}
|
||||
|
||||
PortSet& ports (_output->ports());
|
||||
gain_t tgain;
|
||||
|
||||
if (ports.num_ports () == 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!_active && !_pending_active) {
|
||||
_output->silence (nframes);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
/* this setup is not just for our purposes, but for anything that comes after us in the
|
||||
|
@ -283,7 +283,7 @@ Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample
|
|||
bufs.set_count (output_buffers().count ());
|
||||
Amp::apply_simple_gain (bufs, nframes, GAIN_COEFF_ZERO);
|
||||
}
|
||||
goto out;
|
||||
return;
|
||||
|
||||
} else if (tgain != GAIN_COEFF_UNITY) {
|
||||
|
||||
|
@ -353,9 +353,6 @@ Delivery::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
_active = _pending_active;
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
|
|
|
@ -277,17 +277,8 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
|
|||
const bool midi_only = (c->empty() || !_playlists[DataType::AUDIO]);
|
||||
bool no_disk_output = g_atomic_int_get (&_no_disk_output) != 0;
|
||||
|
||||
if (_active) {
|
||||
if (!_pending_active) {
|
||||
_active = false;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (_pending_active) {
|
||||
_active = true;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (!check_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const gain_t target_gain = ((speed == 0.0) || ((ms & MonitoringDisk) == 0)) ? 0.0 : 1.0;
|
||||
|
|
|
@ -423,11 +423,10 @@ void
|
|||
DiskWriter::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample,
|
||||
double speed, pframes_t nframes, bool result_required)
|
||||
{
|
||||
if (!_active && !_pending_active) {
|
||||
if (!check_active()) {
|
||||
_xrun_flag = false;
|
||||
return;
|
||||
}
|
||||
_active = _pending_active;
|
||||
|
||||
uint32_t n;
|
||||
boost::shared_ptr<ChannelList> c = channels.reader();
|
||||
|
|
|
@ -37,10 +37,9 @@ InternalReturn::InternalReturn (Session& s, Temporal::TimeDomain td, std::string
|
|||
void
|
||||
InternalReturn::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
|
||||
{
|
||||
if (!_active && !_pending_active) {
|
||||
if (!check_active()) {
|
||||
return;
|
||||
}
|
||||
_active = _pending_active;
|
||||
|
||||
Glib::Threads::Mutex::Lock lm (_sends_mutex, Glib::Threads::TRY_LOCK);
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ InternalSend::send_to_going_away ()
|
|||
void
|
||||
InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
|
||||
{
|
||||
if ((!_active && !_pending_active) || !_send_to) {
|
||||
if (!check_active() || !_send_to) {
|
||||
_meter->reset ();
|
||||
return;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa
|
|||
/* we were quiet last time, and we're still supposed to be quiet. */
|
||||
_meter->reset ();
|
||||
Amp::apply_simple_gain (mixbufs, nframes, GAIN_COEFF_ZERO);
|
||||
goto out;
|
||||
return;
|
||||
} else if (tgain != GAIN_COEFF_UNITY) {
|
||||
/* target gain has not changed, but is not zero or unity */
|
||||
Amp::apply_simple_gain (mixbufs, nframes, tgain);
|
||||
|
@ -339,9 +339,6 @@ InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa
|
|||
_thru_delay->run (bufs, start_sample, end_sample, speed, nframes, true);
|
||||
|
||||
/* target will pick up our output when it is ready */
|
||||
|
||||
out:
|
||||
_active = _pending_active;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -92,7 +92,7 @@ PeakMeter::display_name () const
|
|||
void
|
||||
PeakMeter::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
|
||||
{
|
||||
if (!_active && !_pending_active) {
|
||||
if (!check_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -196,8 +196,6 @@ PeakMeter::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end
|
|||
if (_bufcnt > zoh) {
|
||||
_bufcnt = 0;
|
||||
}
|
||||
|
||||
_active = _pending_active;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1254,7 +1254,7 @@ PluginInsert::silence (samplecnt_t nframes, samplepos_t start_sample)
|
|||
{
|
||||
automation_run (start_sample, nframes, true); // evaluate automation only
|
||||
|
||||
if (!active ()) {
|
||||
if (!check_active()) {
|
||||
// XXX delaybuffers need to be offset by nframes
|
||||
return;
|
||||
}
|
||||
|
@ -1328,8 +1328,6 @@ PluginInsert::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa
|
|||
_delaybuffers.flush ();
|
||||
}
|
||||
|
||||
_active = _pending_active;
|
||||
|
||||
/* we have no idea whether the plugin generated silence or not, so mark
|
||||
* all buffers appropriately.
|
||||
*/
|
||||
|
|
|
@ -57,15 +57,16 @@ void
|
|||
PolarityProcessor::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
|
||||
{
|
||||
size_t chn = 0;
|
||||
|
||||
assert (bufs.count().n_audio () <= _current_gain.size());
|
||||
if (!_active && !_pending_active) {
|
||||
|
||||
if (!check_active()) {
|
||||
/* fade all to unity */
|
||||
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i, ++chn) {
|
||||
_current_gain[chn] = Amp::apply_gain (*i, _session.nominal_sample_rate(), nframes, _current_gain[chn], 1.0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
_active = _pending_active;
|
||||
|
||||
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i, ++chn) {
|
||||
_current_gain[chn] = Amp::apply_gain (*i, _session.nominal_sample_rate(), nframes, _current_gain[chn], _control->inverted (chn) ? -1.f : 1.f);
|
||||
|
|
|
@ -147,17 +147,14 @@ PortInsert::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_active && !_pending_active) {
|
||||
if (!check_active()) {
|
||||
/* deliver silence */
|
||||
silence (nframes, start_sample);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
_out->run (bufs, start_sample, end_sample, speed, nframes, true);
|
||||
_input->collect_input (bufs, nframes, ChanCount::ZERO);
|
||||
|
||||
out:
|
||||
_active = _pending_active;
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
|
|
|
@ -110,7 +110,7 @@ Return::set_state (const XMLNode& node, int version)
|
|||
void
|
||||
Return::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
|
||||
{
|
||||
if ((!_active && !_pending_active) || _input->n_ports() == ChanCount::ZERO) {
|
||||
if (!check_active() || (_input->n_ports() == ChanCount::ZERO)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -129,8 +129,6 @@ Return::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample,
|
|||
_meter->run (bufs, start_sample, end_sample, speed, nframes, true);
|
||||
}
|
||||
}
|
||||
|
||||
_active = _pending_active;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -221,10 +221,9 @@ Send::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, do
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_active && !_pending_active) {
|
||||
if (!check_active()) {
|
||||
_meter->reset ();
|
||||
_output->silence (nframes);
|
||||
_active = _pending_active;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ SideChain::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sampl
|
|||
return;
|
||||
}
|
||||
|
||||
if (!_active && !_pending_active) {
|
||||
if (!check_active()) {
|
||||
// zero buffers
|
||||
for (DataType::iterator t = DataType::begin (); t != DataType::end (); ++t) {
|
||||
for (uint32_t out = _configured_input.get (*t); out < bufs.count ().get (*t); ++out) {
|
||||
|
@ -80,8 +80,6 @@ SideChain::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sampl
|
|||
|
||||
_input->collect_input (bufs, nframes, _configured_input);
|
||||
bufs.set_count (_configured_output);
|
||||
|
||||
_active = _pending_active;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in New Issue