From 32be8aa96a6c7c25833e9389c0daeb5008b989ec Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 30 Mar 2023 01:04:40 +0200 Subject: [PATCH] Fix veclib_find_peaks interface vDSP_maxv, vDSP_minv set the return value to -INFINITY or INFINITY respectively before starting to process. Ardour expect the value to be input values to be part of the set. https://developer.apple.com/documentation/accelerate/1450621-vdsp_maxv?language=objc https://developer.apple.com/documentation/accelerate/1450267-vdsp_minv?language=objc --- libs/ardour/mix.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc index 72e926fd0f..7da02f66e7 100644 --- a/libs/ardour/mix.cc +++ b/libs/ardour/mix.cc @@ -159,8 +159,12 @@ veclib_compute_peak (const ARDOUR::Sample * buf, pframes_t nsamples, float curre void veclib_find_peaks (const ARDOUR::Sample * buf, pframes_t nframes, float *min, float *max) { + const float _min = *min; + const float _max = *max; vDSP_maxv (const_cast(buf), 1, max, nframes); vDSP_minv (const_cast(buf), 1, min, nframes); + *min = std::min (*min, _min); + *max = std::max (*max, _max); } void