mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-22 14:46:34 +01:00
Changed Processor interface to support out-of-place processors, for Panner.
git-svn-id: svn://localhost/ardour2/trunk@2106 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
2177f00841
commit
a1052b0eca
16 changed files with 45 additions and 33 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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 () {}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue