diff options
author | David Robillard <d@drobilla.net> | 2007-07-04 22:32:28 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-04 22:32:28 +0000 |
commit | a1052b0eca7bdc8ec1e3ac2996cd16bb48e2a6d2 (patch) | |
tree | 373c7861688e3ee2ec0d9ea04c387b46db85b995 /libs/ardour | |
parent | 2177f008411821e7bce9ca3c306ec64c70b1c58e (diff) |
Changed Processor interface to support out-of-place processors, for Panner.
git-svn-id: svn://localhost/ardour2/trunk@2106 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/amp.cc | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/amp.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/io_processor.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/ladspa_plugin.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/plugin_insert.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/port_insert.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/processor.h | 15 | ||||
-rw-r--r-- | libs/ardour/ardour/send.h | 2 | ||||
-rw-r--r-- | libs/ardour/audio_track.cc | 4 | ||||
-rw-r--r-- | libs/ardour/io.cc | 2 | ||||
-rw-r--r-- | libs/ardour/ladspa_plugin.cc | 6 | ||||
-rw-r--r-- | libs/ardour/midi_track.cc | 2 | ||||
-rw-r--r-- | libs/ardour/plugin_insert.cc | 2 | ||||
-rw-r--r-- | libs/ardour/port_insert.cc | 2 | ||||
-rw-r--r-- | libs/ardour/route.cc | 26 | ||||
-rw-r--r-- | libs/ardour/send.cc | 2 |
16 files changed, 45 insertions, 33 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index dde438b911..ae540b86e8 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -28,7 +28,7 @@ namespace ARDOUR { /** Apply a declicked gain to the audio buffers of @a bufs */ void -Amp::run (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity) +Amp::run_in_place (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity) { if (nframes == 0) return; 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<void,IOProcessor*,bool> 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 () {} diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 4df8ffea49..ffdb47be9d 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -687,7 +687,7 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes if ((processor = boost::dynamic_pointer_cast<Processor>(*i)) != 0) { switch (processor->placement()) { case PreFader: - processor->run (buffers, start, start+nframes, nframes, 0); + processor->run_in_place (buffers, start, start+nframes, nframes, 0); break; case PostFader: post_fader_work = true; @@ -727,7 +727,7 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes case PreFader: break; case PostFader: - processor->run (buffers, start, start+nframes, nframes, 0); + processor->run_in_place (buffers, start, start+nframes, nframes, 0); break; } } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 057d1dcb64..29cc94ffe7 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -254,7 +254,7 @@ IO::deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, } if (dg != _gain || dg != 1.0) - Amp::run(bufs, nframes, _gain, dg, _phase_invert); + Amp::run_in_place(bufs, nframes, _gain, dg, _phase_invert); } // Use the panner to distribute audio to output port buffers diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index 731b76a0bc..5ca4a250cc 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -562,7 +562,7 @@ LadspaPlugin::connect_and_run (BufferSet& bufs, uint32_t& in_index, uint32_t& ou port_index++; } - run (nframes); + run_in_place (nframes); now = get_cycles (); set_cycles ((uint32_t) (now - then)); @@ -606,7 +606,7 @@ LadspaPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const } void -LadspaPlugin::run (nframes_t nframes) +LadspaPlugin::run_in_place (nframes_t nframes) { for (uint32_t i = 0; i < parameter_count(); ++i) { if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) && LADSPA_IS_PORT_CONTROL(port_descriptor (i))) { @@ -656,7 +656,7 @@ LadspaPlugin::latency_compute_run () port_index++; } - run (bufsize); + run_in_place (bufsize); deactivate (); } diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 3f7225ed21..00b76eb08a 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -546,7 +546,7 @@ MidiTrack::process_output_buffers (BufferSet& bufs, Glib::RWLock::ReaderLock rm (_processor_lock, Glib::TRY_LOCK); if (rm.locked()) { for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - (*i)->run (bufs, start_frame, end_frame, nframes, offset); + (*i)->run_in_place (bufs, start_frame, end_frame, nframes, offset); } } } diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 1859c5405f..58009e6b5a 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -313,7 +313,7 @@ PluginInsert::silence (nframes_t nframes, nframes_t offset) } void -PluginInsert::run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) +PluginInsert::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) { if (active()) { diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index 06cbcecc38..e14835b083 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -84,7 +84,7 @@ PortInsert::~PortInsert () } void -PortInsert::run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) +PortInsert::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) { if (_io->n_outputs().n_total() == 0) { return; diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index d14f1de087..914e936d6b 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -295,17 +295,17 @@ Route::process_output_buffers (BufferSet& bufs, -------------------------------------------------------------------------------------------------- */ if (declick > 0) { - Amp::run (bufs, nframes, 0.0, 1.0, false); + Amp::run_in_place (bufs, nframes, 0.0, 1.0, false); _pending_declick = 0; } else if (declick < 0) { - Amp::run (bufs, nframes, 1.0, 0.0, false); + Amp::run_in_place (bufs, nframes, 1.0, 0.0, false); _pending_declick = 0; } else { /* no global declick */ if (solo_gain != dsg) { - Amp::run (bufs, nframes, solo_gain, dsg, false); + Amp::run_in_place (bufs, nframes, solo_gain, dsg, false); solo_gain = dsg; } } @@ -320,7 +320,7 @@ Route::process_output_buffers (BufferSet& bufs, } if (!_soloed && _mute_affects_pre_fader && (mute_gain != dmg)) { - Amp::run (bufs, nframes, mute_gain, dmg, false); + Amp::run_in_place (bufs, nframes, mute_gain, dmg, false); mute_gain = dmg; mute_declick_applied = true; } @@ -381,7 +381,7 @@ Route::process_output_buffers (BufferSet& bufs, for (i = _processors.begin(); i != _processors.end(); ++i) { switch ((*i)->placement()) { case PreFader: - (*i)->run (bufs, start_frame, end_frame, nframes, offset); + (*i)->run_in_place (bufs, start_frame, end_frame, nframes, offset); break; case PostFader: post_fader_work = true; @@ -407,7 +407,7 @@ Route::process_output_buffers (BufferSet& bufs, bufs.set_count(pre_fader_streams()); if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_post_fader) { - Amp::run (bufs, nframes, mute_gain, dmg, false); + Amp::run_in_place (bufs, nframes, mute_gain, dmg, false); mute_gain = dmg; mute_declick_applied = true; } @@ -417,7 +417,7 @@ Route::process_output_buffers (BufferSet& bufs, -------------------------------------------------------------------------------------------------- */ if (meter && (_meter_point == MeterPreFader)) { - _meter->run(bufs, start_frame, end_frame, nframes, offset); + _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset); } @@ -498,7 +498,7 @@ Route::process_output_buffers (BufferSet& bufs, if (_gain != dg) { - Amp::run (bufs, nframes, _gain, dg, _phase_invert); + Amp::run_in_place (bufs, nframes, _gain, dg, _phase_invert); _gain = dg; } else if (_gain != 0 && (_phase_invert || _gain != 1.0)) { @@ -551,7 +551,7 @@ Route::process_output_buffers (BufferSet& bufs, case PreFader: break; case PostFader: - (*i)->run (bufs, start_frame, end_frame, nframes, offset); + (*i)->run_in_place (bufs, start_frame, end_frame, nframes, offset); break; } } @@ -570,7 +570,7 @@ Route::process_output_buffers (BufferSet& bufs, } if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_control_outs) { - Amp::run (bufs, nframes, mute_gain, dmg, false); + Amp::run_in_place (bufs, nframes, mute_gain, dmg, false); mute_gain = dmg; mute_declick_applied = true; } @@ -615,7 +615,7 @@ Route::process_output_buffers (BufferSet& bufs, ----------------------------------------------------------------------*/ if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_main_outs) { - Amp::run (bufs, nframes, mute_gain, dmg, false); + Amp::run_in_place (bufs, nframes, mute_gain, dmg, false); mute_gain = dmg; mute_declick_applied = true; } @@ -677,7 +677,7 @@ Route::process_output_buffers (BufferSet& bufs, if ((_gain == 0 && !apply_gain_automation) || dmg == 0) { _meter->reset(); } else { - _meter->run(output_buffers(), start_frame, end_frame, nframes, offset); + _meter->run_in_place(output_buffers(), start_frame, end_frame, nframes, offset); } } } @@ -698,7 +698,7 @@ Route::passthru (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, collect_input (bufs, nframes, offset); if (meter_first) { - _meter->run(bufs, start_frame, end_frame, nframes, offset); + _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset); meter_first = false; } diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 3c22abf25c..5567649c9a 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -113,7 +113,7 @@ Send::set_state(const XMLNode& node) } void -Send::run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) +Send::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) { if (active()) { |