The FloatVectorOperations class is insanely useful and convenient! One request I have is that it would be amazing if the findMinimum and findMaximum functions could return not only the actual min/max values, but the indices in the vectors at which these values are found.
if JUCE_USE_VDSP framework is enabled, it’s easy enough to do with the vDSP functions vDSP_minvi and vDSP_minviD, but it would be awesome if this could all be wrapped in one nice cross-platform function call instead of having to use preprocessor conditionals and writing alternate code in case vDSP can’t be used:
template<typename SampleType>
int PitchDetector<SampleType>::indexOfMinElement (const SampleType* data, const int dataSize)
{
SampleType min = data[0];
int minIndex = 0;
#ifndef JUCE_USE_VDSP_FRAMEWORK
for (int n = 1; n < dataSize; ++n)
{
const SampleType current = data[n];
if (current < min)
{
min = current;
minIndex = n;
}
}
#else
#if !DOUBLE_SAMPLES
vDSP_minvi (data, 1, &min, (vDSP_Length *)&minIndex, dataSize);
#else
vDSP_minviD(data, 1, &min, (vDSP_Length *)&minIndex, dataSize);
#endif
#endif
return minIndex;
}
just my two cents. thanks!