summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-11-25 23:29:52 +0000
committerCarl Hetherington <carl@carlh.net>2009-11-25 23:29:52 +0000
commit47b8fa21699e58f733f0ecb879193092f93c93d8 (patch)
treea47e1b89847432a89dba16f09cf8dc4700ee8d6f /libs
parentfe59ade87415d72072009f1e77a892f9989819a0 (diff)
Give Processor::run a new parameter to say whether or not the run method must leave
the passed-in buffers valid. In the case where the main outs delivery is the last processor in a route, this is not necessary (and wasteful). If another processor (e.g. a meter) follows the main outs, the passed-in (scratch) buffers must be valid or the meter will get garbage data. Fixes meters displaying phantom signals in some cases. git-svn-id: svn://localhost/ardour2/branches/3.0@6180 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/amp.cc2
-rw-r--r--libs/ardour/ardour/amp.h2
-rw-r--r--libs/ardour/ardour/delivery.h2
-rw-r--r--libs/ardour/ardour/internal_return.h2
-rw-r--r--libs/ardour/ardour/internal_send.h2
-rw-r--r--libs/ardour/ardour/meter.h2
-rw-r--r--libs/ardour/ardour/plugin_insert.h2
-rw-r--r--libs/ardour/ardour/port_insert.h2
-rw-r--r--libs/ardour/ardour/processor.h5
-rw-r--r--libs/ardour/ardour/return.h2
-rw-r--r--libs/ardour/ardour/send.h2
-rw-r--r--libs/ardour/audio_track.cc2
-rw-r--r--libs/ardour/delivery.cc10
-rw-r--r--libs/ardour/internal_return.cc2
-rw-r--r--libs/ardour/internal_send.cc6
-rw-r--r--libs/ardour/io.cc2
-rw-r--r--libs/ardour/meter.cc2
-rw-r--r--libs/ardour/plugin_insert.cc2
-rw-r--r--libs/ardour/port_insert.cc4
-rw-r--r--libs/ardour/return.cc6
-rw-r--r--libs/ardour/route.cc4
-rw-r--r--libs/ardour/send.cc8
22 files changed, 42 insertions, 31 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc
index 2100d736a8..9f52a276f4 100644
--- a/libs/ardour/amp.cc
+++ b/libs/ardour/amp.cc
@@ -72,7 +72,7 @@ Amp::configure_io (ChanCount in, ChanCount out)
}
void
-Amp::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes)
+Amp::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes, bool)
{
gain_t mute_gain;
diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h
index 724b1095a1..c237479abd 100644
--- a/libs/ardour/ardour/amp.h
+++ b/libs/ardour/ardour/amp.h
@@ -44,7 +44,7 @@ public:
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
bool configure_io (ChanCount in, ChanCount out);
- void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+ void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
bool apply_gain() const { return _apply_gain; }
void apply_gain(bool yn) { _apply_gain = yn; }
diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h
index add222a0f1..1b1a217466 100644
--- a/libs/ardour/ardour/delivery.h
+++ b/libs/ardour/ardour/delivery.h
@@ -65,7 +65,7 @@ public:
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
bool configure_io (ChanCount in, ChanCount out);
- void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+ void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
/* supplemental method used with MIDI */
diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h
index dfd37a4de5..205559fe4e 100644
--- a/libs/ardour/ardour/internal_return.h
+++ b/libs/ardour/ardour/internal_return.h
@@ -40,7 +40,7 @@ class InternalReturn : public Return
XMLNode& get_state(void);
int set_state(const XMLNode&, int version);
- void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+ void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
bool configure_io (ChanCount in, ChanCount out);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
void set_block_size (nframes_t);
diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h
index 245a136dc8..ac184a69bf 100644
--- a/libs/ardour/ardour/internal_send.h
+++ b/libs/ardour/ardour/internal_send.h
@@ -40,7 +40,7 @@ class InternalSend : public Send
XMLNode& get_state(void);
int set_state(const XMLNode& node, int version);
- void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+ void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
bool feeds (boost::shared_ptr<Route> other) const;
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
bool configure_io (ChanCount in, ChanCount out);
diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h
index 10272ee733..e0b956c0f9 100644
--- a/libs/ardour/ardour/meter.h
+++ b/libs/ardour/ardour/meter.h
@@ -61,7 +61,7 @@ public:
bool configure_io (ChanCount in, ChanCount out);
/** Compute peaks */
- void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+ void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
float peak_power (uint32_t n) {
if (n < _visible_peak_power.size()) {
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index 348cda218e..593db1ff0d 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -54,7 +54,7 @@ class PluginInsert : public Processor
XMLNode& get_state(void);
int set_state(const XMLNode&, int version);
- void run (BufferSet& in, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+ void run (BufferSet& in, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
void silence (nframes_t nframes);
void activate ();
diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h
index 3283415e6d..f013a6a442 100644
--- a/libs/ardour/ardour/port_insert.h
+++ b/libs/ardour/ardour/port_insert.h
@@ -51,7 +51,7 @@ class PortInsert : public IOProcessor
XMLNode& get_state(void);
int set_state (const XMLNode&, int version);
- void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+ void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
nframes_t signal_latency() const;
diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h
index 3ec4a9885d..c57eb4354c 100644
--- a/libs/ardour/ardour/processor.h
+++ b/libs/ardour/ardour/processor.h
@@ -70,7 +70,10 @@ class Processor : public SessionObject, public AutomatableControls, public Laten
virtual void set_block_size (nframes_t /*nframes*/) {}
- virtual void run (BufferSet& /*bufs*/, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t /*nframes*/) {}
+ /** @param result_required true if, on return from this method, bufs is required to contain valid data;
+ * if false, the method need not bother writing to bufs if it doesn't want to.
+ */
+ virtual void run (BufferSet& /*bufs*/, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t /*nframes*/, bool /*result_required*/) {}
virtual void silence (nframes_t /*nframes*/) {}
virtual void activate () { _pending_active = true; ActiveChanged(); }
diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h
index b3212fe4a0..a3d3859899 100644
--- a/libs/ardour/ardour/return.h
+++ b/libs/ardour/ardour/return.h
@@ -44,7 +44,7 @@ public:
uint32_t bit_slot() const { return _bitslot; }
- void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+ void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
boost::shared_ptr<Amp> amp() const { return _amp; }
boost::shared_ptr<PeakMeter> meter() const { return _meter; }
diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h
index b86d321bd2..78a82820df 100644
--- a/libs/ardour/ardour/send.h
+++ b/libs/ardour/ardour/send.h
@@ -57,7 +57,7 @@ class Send : public Delivery
uint32_t pans_required() const { return _configured_input.n_audio(); }
- void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
+ void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
bool configure_io (ChanCount in, ChanCount out);
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 1a92cd5459..383eb982b1 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -675,7 +675,7 @@ AudioTrack::export_stuff (BufferSet& buffers, sframes_t start, nframes_t nframes
for (i = _processors.begin(); i != _processors.end(); ++i) {
boost::shared_ptr<Processor> processor;
if ((processor = boost::dynamic_pointer_cast<Processor>(*i)) != 0) {
- processor->run (buffers, start, start+nframes, nframes);
+ processor->run (buffers, start, start+nframes, nframes, true);
}
}
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index 72f24c065e..ec2ae7d4cc 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -275,7 +275,7 @@ Delivery::configure_io (ChanCount in, ChanCount out)
}
void
-Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
+Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool result_required)
{
assert (_output);
@@ -318,7 +318,9 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra
*/
_output->silence (nframes);
- Amp::apply_simple_gain (bufs, nframes, 0.0);
+ if (result_required) {
+ Amp::apply_simple_gain (bufs, nframes, 0.0);
+ }
goto out;
} else if (tgain != 1.0) {
@@ -333,6 +335,10 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra
_panner->run (bufs, output_buffers(), start_frame, end_frame, nframes);
+ if (result_required) {
+ bufs.read_from (output_buffers (), nframes);
+ }
+
} else {
// Do a 1:1 copy of data to output ports
diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc
index 8a3baf5bda..86d0a2deea 100644
--- a/libs/ardour/internal_return.cc
+++ b/libs/ardour/internal_return.cc
@@ -44,7 +44,7 @@ InternalReturn::InternalReturn (Session& s, const XMLNode& node)
}
void
-InternalReturn::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes)
+InternalReturn::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes, bool)
{
if (!_active && !_pending_active) {
return;
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index f44c0617db..314e684e7d 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -71,7 +71,7 @@ InternalSend::send_to_going_away ()
}
void
-InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
+InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool)
{
if ((!_active && !_pending_active) || !target || !_send_to) {
_meter->reset ();
@@ -114,7 +114,7 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
// so that we don't overwrite the main automation data for the route amp
// _amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (mixbufs, start_frame, end_frame, nframes);
+ _amp->run (mixbufs, start_frame, end_frame, nframes, true);
/* XXX NEED TO PAN */
@@ -124,7 +124,7 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
- _meter->run (mixbufs, start_frame, end_frame, nframes);
+ _meter->run (mixbufs, start_frame, end_frame, nframes, true);
}
}
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index c645894591..fe2dfb1f7a 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -1484,7 +1484,7 @@ IO::process_input (boost::shared_ptr<Processor> proc, sframes_t start_frame, sfr
/* don't read the data into new buffers - just use the port buffers directly */
bufs.attach_buffers (_ports, nframes, 0);
- proc->run (bufs, start_frame, end_frame, nframes);
+ proc->run (bufs, start_frame, end_frame, nframes, true);
}
void
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc
index e5fcc16f29..0d3e8e228a 100644
--- a/libs/ardour/meter.cc
+++ b/libs/ardour/meter.cc
@@ -71,7 +71,7 @@ Metering::update_meters()
* be set to 0.
*/
void
-PeakMeter::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes)
+PeakMeter::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes, bool)
{
if (!_active && !_pending_active) {
return;
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index 1d9d274a09..6957d55f57 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -367,7 +367,7 @@ PluginInsert::silence (nframes_t nframes)
}
void
-PluginInsert::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes)
+PluginInsert::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes, bool)
{
if (_active || _pending_active) {
diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc
index 3b02bf41da..4df27bff72 100644
--- a/libs/ardour/port_insert.cc
+++ b/libs/ardour/port_insert.cc
@@ -66,7 +66,7 @@ PortInsert::~PortInsert ()
}
void
-PortInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
+PortInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool)
{
if (_output->n_ports().n_total() == 0) {
return;
@@ -78,7 +78,7 @@ PortInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nf
goto out;
}
- _out->run (bufs, start_frame, end_frame, nframes);
+ _out->run (bufs, start_frame, end_frame, nframes, true);
_input->collect_input (bufs, nframes, ChanCount::ZERO);
out:
diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc
index f5122f3a5f..82d1cf6ff2 100644
--- a/libs/ardour/return.cc
+++ b/libs/ardour/return.cc
@@ -120,7 +120,7 @@ Return::set_state (const XMLNode& node, int version)
}
void
-Return::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
+Return::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool)
{
if ((!_active && !_pending_active) || _input->n_ports() == ChanCount::ZERO) {
return;
@@ -132,13 +132,13 @@ Return::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframe
// Can't automate gain for sends or returns yet because we need different buffers
// so that we don't overwrite the main automation data for the route amp
// _amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (bufs, start_frame, end_frame, nframes);
+ _amp->run (bufs, start_frame, end_frame, nframes, true);
if (_metering) {
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
- _meter->run (bufs, start_frame, end_frame, nframes);
+ _meter->run (bufs, start_frame, end_frame, nframes, true);
}
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 6941b537f3..8d7c170759 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -423,13 +423,15 @@ Route::process_output_buffers (BufferSet& bufs,
if (rm.locked()) {
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+
if (bufs.count() != (*i)->input_streams()) {
cerr << _name << " bufs = " << bufs.count()
<< " input for " << (*i)->name() << " = " << (*i)->input_streams()
<< endl;
}
assert (bufs.count() == (*i)->input_streams());
- (*i)->run (bufs, start_frame, end_frame, nframes);
+
+ (*i)->run (bufs, start_frame, end_frame, nframes, *i != _processors.back());
bufs.set_count (ChanCount::max(bufs.count(), (*i)->output_streams()));
}
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index 91e6827e61..6117b09be2 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -87,7 +87,7 @@ Send::deactivate ()
}
void
-Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
+Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool)
{
if (_output->n_ports() == ChanCount::ZERO) {
_meter->reset ();
@@ -114,11 +114,11 @@ Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_
// Can't automate gain for sends or returns yet because we need different buffers
// so that we don't overwrite the main automation data for the route amp
// _amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (sendbufs, start_frame, end_frame, nframes);
+ _amp->run (sendbufs, start_frame, end_frame, nframes, true);
/* deliver to outputs */
- Delivery::run (sendbufs, start_frame, end_frame, nframes);
+ Delivery::run (sendbufs, start_frame, end_frame, nframes, true);
/* consider metering */
@@ -126,7 +126,7 @@ Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
- _meter->run (*_output_buffers, start_frame, end_frame, nframes);
+ _meter->run (*_output_buffers, start_frame, end_frame, nframes, true);
}
}