summaryrefslogtreecommitdiff
path: root/media/libsoundtouch/src/TDStretch.h
diff options
context:
space:
mode:
Diffstat (limited to 'media/libsoundtouch/src/TDStretch.h')
-rw-r--r--media/libsoundtouch/src/TDStretch.h59
1 files changed, 33 insertions, 26 deletions
diff --git a/media/libsoundtouch/src/TDStretch.h b/media/libsoundtouch/src/TDStretch.h
index b390736913..3ef79c7cdf 100644
--- a/media/libsoundtouch/src/TDStretch.h
+++ b/media/libsoundtouch/src/TDStretch.h
@@ -13,13 +13,6 @@
///
////////////////////////////////////////////////////////////////////////////////
//
-// Last changed : $Date: 2014-04-06 15:57:21 +0000 (Sun, 06 Apr 2014) $
-// File revision : $Revision: 4 $
-//
-// $Id: TDStretch.h 195 2014-04-06 15:57:21Z oparviai $
-//
-////////////////////////////////////////////////////////////////////////////////
-//
// License :
//
// SoundTouch audio processing library
@@ -112,39 +105,47 @@ class TDStretch : public FIFOProcessor
protected:
int channels;
int sampleReq;
- float tempo;
- SAMPLETYPE *pMidBuffer;
- SAMPLETYPE *pMidBufferUnaligned;
int overlapLength;
int seekLength;
int seekWindowLength;
- int overlapDividerBits;
+ int overlapDividerBitsNorm;
+ int overlapDividerBitsPure;
int slopingDivider;
- float nominalSkip;
- float skipFract;
- FIFOSampleBuffer outputBuffer;
- FIFOSampleBuffer inputBuffer;
- bool bQuickSeek;
-
int sampleRate;
int sequenceMs;
int seekWindowMs;
int overlapMs;
+
+ unsigned long maxnorm;
+ float maxnormf;
+
+ double tempo;
+ double nominalSkip;
+ double skipFract;
+
+ bool bQuickSeek;
bool bAutoSeqSetting;
bool bAutoSeekSetting;
+ bool isBeginning;
+
+ SAMPLETYPE *pMidBuffer;
+ SAMPLETYPE *pMidBufferUnaligned;
+
+ FIFOSampleBuffer outputBuffer;
+ FIFOSampleBuffer inputBuffer;
void acceptNewOverlapLength(int newOverlapLength);
virtual void clearCrossCorrState();
void calculateOverlapLength(int overlapMs);
- virtual double calcCrossCorr(const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare, double &norm) const;
- virtual double calcCrossCorrAccumulate(const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare, double &norm) const;
+ virtual double calcCrossCorr(const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare, double &norm);
+ virtual double calcCrossCorrAccumulate(const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare, double &norm);
virtual int seekBestOverlapPositionFull(const SAMPLETYPE *refPos);
virtual int seekBestOverlapPositionQuick(const SAMPLETYPE *refPos);
- int seekBestOverlapPosition(const SAMPLETYPE *refPos);
+ virtual int seekBestOverlapPosition(const SAMPLETYPE *refPos);
virtual void overlapStereo(SAMPLETYPE *output, const SAMPLETYPE *input) const;
virtual void overlapMono(SAMPLETYPE *output, const SAMPLETYPE *input) const;
@@ -154,6 +155,7 @@ protected:
void overlap(SAMPLETYPE *output, const SAMPLETYPE *input, uint ovlPos) const;
void calcSeqParameters();
+ void adaptNormalizer();
/// Changes the tempo of the given sound samples.
/// Returns amount of samples returned in the "output" buffer.
@@ -182,7 +184,7 @@ public:
/// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower
/// tempo, larger faster tempo.
- void setTempo(float newTempo);
+ void setTempo(double newTempo);
/// Returns nonzero if there aren't any samples available for outputting.
virtual void clear();
@@ -238,8 +240,13 @@ public:
{
return seekWindowLength - overlapLength;
}
-};
+ /// return approximate initial input-output latency
+ int getLatency() const
+ {
+ return sampleReq;
+ }
+};
// Implementation-specific class declarations:
@@ -249,8 +256,8 @@ public:
class TDStretchMMX : public TDStretch
{
protected:
- double calcCrossCorr(const short *mixingPos, const short *compare, double &norm) const;
- double calcCrossCorrAccumulate(const short *mixingPos, const short *compare, double &norm) const;
+ double calcCrossCorr(const short *mixingPos, const short *compare, double &norm);
+ double calcCrossCorrAccumulate(const short *mixingPos, const short *compare, double &norm);
virtual void overlapStereo(short *output, const short *input) const;
virtual void clearCrossCorrState();
};
@@ -262,8 +269,8 @@ public:
class TDStretchSSE : public TDStretch
{
protected:
- double calcCrossCorr(const float *mixingPos, const float *compare, double &norm) const;
- double calcCrossCorrAccumulate(const float *mixingPos, const float *compare, double &norm) const;
+ double calcCrossCorr(const float *mixingPos, const float *compare, double &norm);
+ double calcCrossCorrAccumulate(const float *mixingPos, const float *compare, double &norm);
};
#endif /// SOUNDTOUCH_ALLOW_SSE