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
This commit is contained in:
Robin Gareus 2023-03-30 01:04:40 +02:00
parent ef7b7f4c89
commit 32be8aa96a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 4 additions and 0 deletions

View File

@ -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<ARDOUR::Sample*>(buf), 1, max, nframes);
vDSP_minv (const_cast<ARDOUR::Sample*>(buf), 1, min, nframes);
*min = std::min (*min, _min);
*max = std::max (*max, _max);
}
void