From a1052b0eca7bdc8ec1e3ac2996cd16bb48e2a6d2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 4 Jul 2007 22:32:28 +0000 Subject: Changed Processor interface to support out-of-place processors, for Panner. git-svn-id: svn://localhost/ardour2/trunk@2106 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/amp.h | 4 ++-- libs/ardour/ardour/io_processor.h | 3 ++- libs/ardour/ardour/ladspa_plugin.h | 2 +- libs/ardour/ardour/plugin_insert.h | 2 +- libs/ardour/ardour/port_insert.h | 2 +- libs/ardour/ardour/processor.h | 15 +++++++++++++-- libs/ardour/ardour/send.h | 2 +- 7 files changed, 21 insertions(+), 9 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index e5a4c189e9..cdbcacbd91 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -29,11 +29,11 @@ class BufferSet; /** Applies a declick operation to all audio inputs, passing the same number of * audio outputs, and passing through any other types unchanged. * - * FIXME: make this an insert. + * FIXME: make this a Processor. */ class Amp { public: - static void run (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity); + static void run_in_place (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity); static void apply_simple_gain(BufferSet& bufs, nframes_t nframes, gain_t target); }; diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index c6224969b9..409ad91b15 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -67,7 +67,8 @@ class IOProcessor : public Processor virtual void automation_snapshot (nframes_t now) { _io->automation_snapshot(now); } - virtual void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) = 0; + virtual void run_in_place (BufferSet& in, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) = 0; + void silence (nframes_t nframes, nframes_t offset); sigc::signal AutomationPlaybackChanged; diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index a3e43f4cec..4c8d9ff741 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -133,7 +133,7 @@ class LadspaPlugin : public ARDOUR::Plugin bool was_activated; void init (void *mod, uint32_t index, nframes_t rate); - void run (nframes_t nsamples); + void run_in_place (nframes_t nsamples); void latency_compute_run (); }; diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index c78a17b218..0694fa2a68 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&); - void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); + void run_in_place (BufferSet& in, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); void silence (nframes_t nframes, nframes_t offset); void activate (); diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 619e2e5bd2..114d196750 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -52,7 +52,7 @@ class PortInsert : public IOProcessor void init (); - void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); + void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); nframes_t signal_latency() const; diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 371572610a..bf9dfe0430 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -72,7 +72,10 @@ class Processor : public Automatable, public Latent virtual void set_block_size (nframes_t nframes) {} - virtual void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) = 0; + virtual void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) { assert(is_in_place()); } + + virtual void run_out_of_place (BufferSet& input, BufferSet& output, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) { assert(is_out_of_place()); } + virtual void silence (nframes_t nframes, nframes_t offset) {} virtual void activate () { _active = true; ActiveChanged.emit(); } @@ -80,7 +83,15 @@ class Processor : public Automatable, public Latent virtual bool configure_io (ChanCount in, ChanCount out) { _configured_input = in; return (_configured = true); } - /* Derived classes should override these, or processor appears as a pass-through */ + /* Derived classes should override these, or processor appears as an in-place pass-through */ + + /** In-place processors implement run_in_place and modify thee input buffer parameter */ + virtual bool is_in_place () const { return true; } + + /* Out-Of-Place processors implement run_out_of_place, don't modify the input parameter + * and write to their output parameter */ + virtual bool is_out_of_place () const { return false; } + virtual bool can_support_input_configuration (ChanCount in) const { return true; } virtual ChanCount output_for_input_configuration (ChanCount in) const { return in; } virtual ChanCount output_streams() const { return _configured_input; } diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 26d0351bb2..018df96be4 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -45,7 +45,7 @@ class Send : public IOProcessor ChanCount output_streams() const; ChanCount input_streams () const; - void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); + void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); void activate() {} void deactivate () {} -- cgit v1.2.3