diff options
author | David Robillard <d@drobilla.net> | 2007-03-18 06:07:08 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-03-18 06:07:08 +0000 |
commit | 99904735e066804358f1d0bd138a84f1e9ecda91 (patch) | |
tree | 71a924cf1660b5b00231275bd481bbd27094dd9b /libs/ardour/mix.cc | |
parent | eb270e70a12c410cdd98585ad25bb6d8e384a4f5 (diff) |
Merged with trunk R1612.
git-svn-id: svn://localhost/ardour2/branches/midi@1614 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/mix.cc')
-rw-r--r-- | libs/ardour/mix.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc index 6b7755e498..2d31c8ccc8 100644 --- a/libs/ardour/mix.cc +++ b/libs/ardour/mix.cc @@ -15,7 +15,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #include <cmath> @@ -25,7 +24,6 @@ #include <stdint.h> #if defined (ARCH_X86) && defined (BUILD_SSE_OPTIMIZATIONS) - // Debug wrappers float @@ -92,6 +90,25 @@ compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) } void +find_peaks (ARDOUR::Sample *buf, nframes_t nframes, float *min, float *max) +{ + nframes_t i; + float a, b; + + a = *max; + b = *min; + + for (i = 0; i < nframes; i++) + { + a = fmax (buf[i], a); + b = fmin (buf[i], b); + } + + *max = a; + *min = b; +} + +void apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain) { for (nframes_t i=0; i<nframes; i++) @@ -126,6 +143,13 @@ veclib_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) } void +veclib_find_peaks (ARDOUR::Sample *buf, nframes_t nframes, float *min, float *max) +{ + vDSP_maxv (buf, 1, max, nframes); + vDSP_minv (buf, 1, min, nframes); +} + +void veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain) { vDSP_vsmul(buf, 1, &gain, buf, 1, nframes); |