From c3e666867cfd44768c9aa605abefde78274ace24 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 2 May 2007 15:21:51 +0000 Subject: reintroduce use of optimized functions for gain into buffer code, and cleanup the way they are declared to avoid depending on Session git-svn-id: svn://localhost/ardour2/branches/midi@1775 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/buffer.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'libs/ardour/ardour/buffer.h') diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h index 828eac4d64..6000872bdd 100644 --- a/libs/ardour/ardour/buffer.h +++ b/libs/ardour/ardour/buffer.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace ARDOUR { @@ -142,21 +143,13 @@ public: Sample* const dst_raw = _data + offset; const Sample* const src_raw = src.data(len); - for (jack_nframes_t n = 0; n < len; ++n) { - dst_raw[n] += src_raw[n] * gain_coeff; - } - + mix_buffers_with_gain (dst_raw, src_raw, len, gain_coeff); + _silent = ( (src.silent() && _silent) || (_silent && gain_coeff == 0) ); } void apply_gain(gain_t gain, jack_nframes_t len, jack_nframes_t offset=0) { - Sample* const buf = _data + offset; - - for (jack_nframes_t n = 0; n < len; ++n) { - buf[n] *= gain; - } - - _silent = (_silent || gain == 0); + apply_gain_to_buffer (_data + offset, len, gain); } /** Set the data contained by this buffer manually (for setting directly to jack buffer). -- cgit v1.2.3