diff options
author | David Robillard <d@drobilla.net> | 2007-05-10 00:41:04 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-05-10 00:41:04 +0000 |
commit | 1e7bcd8b0fd451117e241bf49660684314b5757f (patch) | |
tree | 1db61b5cfe032942833890b93b6cd0167bca5c7c /libs/ardour/amp.cc | |
parent | 185be4e841e182bbe7cb7820f9cb6371ebebe15d (diff) |
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
Diffstat (limited to 'libs/ardour/amp.cc')
-rw-r--r-- | libs/ardour/amp.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index ca1aa74bb5..c437b53243 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -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); // if we don't need to declick, defer to apply_simple_gain - if (initial == target) { - for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { - apply_gain_to_buffer (i->data (), nframes, target); + if (target == 0.0) { + 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; } |