public static List <FFTBinInfo> GetLowerMaxBins(float[] magnitudes, int fromIndex, int toIndex, float binFrequencyWidth, float magThresholdRatio)
{
List <FFTBinInfo> maxBins = new List <FFTBinInfo>();
FFTBinInfo binInfo;
int maxIndex;
float magThreshold;
fromIndex++;
toIndex--;
maxIndex = GATMaths.GetIndexOfMaxValue(magnitudes, fromIndex, toIndex);
binInfo = new FFTBinInfo(magnitudes, maxIndex, binFrequencyWidth);
maxBins.Add(binInfo);
magThreshold = binInfo.InterpolatedMagnitude * magThresholdRatio;
while (true)
{
toIndex = binInfo.BinIndex - 1;
if (toIndex - fromIndex < 3)
{
break;
}
maxIndex = GATMaths.GetIndexOfMaxValue(magnitudes, fromIndex, toIndex);
binInfo = new FFTBinInfo(magnitudes, maxIndex, binFrequencyWidth);
if (binInfo.InterpolatedMagnitude < magThreshold)
{
break;
}
maxBins.Add(binInfo);
}
return(maxBins);
}