Updated SoundTouch library to 1.9.2

This commit is contained in:
skidau
2015-12-28 23:07:53 +11:00
parent aabcd441d9
commit cfa925fbbe
27 changed files with 497 additions and 286 deletions

View File

@ -11,10 +11,10 @@
///
////////////////////////////////////////////////////////////////////////////////
//
// Last changed : $Date: 2012-12-29 06:52:47 +1100 (Sat, 29 Dec 2012) $
// Last changed : $Date: 2015-05-18 18:22:02 +0300 (Mon, 18 May 2015) $
// File revision : $Revision: 4 $
//
// $Id: PeakFinder.cpp 164 2012-12-28 19:52:47Z oparviai $
// $Id: PeakFinder.cpp 213 2015-05-18 15:22:02Z oparviai $
//
////////////////////////////////////////////////////////////////////////////////
//
@ -192,11 +192,21 @@ double PeakFinder::getPeakCenter(const float *data, int peakpos) const
gp1 = findGround(data, peakpos, -1);
gp2 = findGround(data, peakpos, 1);
groundLevel = 0.5f * (data[gp1] + data[gp2]);
peakLevel = data[peakpos];
// calculate 70%-level of the peak
cutLevel = 0.70f * peakLevel + 0.30f * groundLevel;
if (gp1 == gp2)
{
// avoid rounding errors when all are equal
assert(gp1 == peakpos);
cutLevel = groundLevel = peakLevel;
} else {
// get average of the ground levels
groundLevel = 0.5f * (data[gp1] + data[gp2]);
// calculate 70%-level of the peak
cutLevel = 0.70f * peakLevel + 0.30f * groundLevel;
}
// find mid-level crossings
crosspos1 = findCrossingLevel(data, cutLevel, peakpos, -1);
crosspos2 = findCrossingLevel(data, cutLevel, peakpos, 1);