13
0

Gain performance improvements (don't waste time applying gain when not necessary).

git-svn-id: svn://localhost/ardour2/branches/midi@1811 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2007-05-10 00:41:04 +00:00
parent 185be4e841
commit 1e7bcd8b0f
2 changed files with 10 additions and 4 deletions

View File

@ -39,10 +39,15 @@ Amp::run (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, boo
// assert(bufs.buffer_capacity(DataType::AUDIO) >= nframes); // assert(bufs.buffer_capacity(DataType::AUDIO) >= nframes);
// if we don't need to declick, defer to apply_simple_gain // if we don't need to declick, defer to apply_simple_gain
if (initial == target) { if (initial == target) {
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { if (target == 0.0) {
apply_gain_to_buffer (i->data (), nframes, target); for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
memset (i->data(), 0, sizeof (Sample) * nframes);
}
} else if (target != 1.0) {
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
apply_gain_to_buffer (i->data(), nframes, target);
}
} }
return; return;
} }

View File

@ -249,7 +249,8 @@ IO::deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame,
} }
Amp::run(bufs, nframes, _gain, dg, _phase_invert); if (dg != _gain || dg != 1.0)
Amp::run(bufs, nframes, _gain, dg, _phase_invert);
} }
// Use the panner to distribute audio to output port buffers // Use the panner to distribute audio to output port buffers