Permalink
Browse files

Refs #1104. SoundTouch resync.

Syncs to 1.31.

I didn't take the MMX changes because our MMX code is faster and more versatile.
I also didn't take the SSE & the windows specific changes, we don't use the floating point sample code, and don't have a functioning windows port to test the changes with.



git-svn-id: http://svn.mythtv.org/svn/trunk@9996 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information...
daniel-kristjansson committed May 23, 2006
1 parent 0738eb9 commit 14a7fbf798ac072a5039b273af47a388b8dc1824
@@ -7,8 +7,8 @@
/// transposing the sample rate with interpolation.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai @ iki.fi
/// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
@@ -21,8 +21,8 @@
/// function, calculates it's precise location and converts this reading to bpm's.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai @ iki.fi
/// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
@@ -58,6 +58,7 @@
#define _BPMDetect_H_
#include "STTypes.h"
#include "FIFOSampleBuffer.h"
/// Minimum allowed BPM rate. Used to restrict accepted result above a reasonable limit.
#define MIN_BPM 45
@@ -66,9 +67,6 @@
#define MAX_BPM 230
/// Internal class prototype
class FIFOSampleBuffer;
/// Class for calculating BPM rate for audio data.
class BPMDetect
{
@@ -105,7 +103,7 @@ class BPMDetect
int windowStart;
/// FIFO-buffer for decimated processing samples.
FIFOSampleBuffer *buffer;
soundtouch::FIFOSampleBuffer *buffer;
/// Initialize the class for processing.
void init(int numChannels, int sampleRate);
@@ -10,8 +10,8 @@
/// whenever necessary.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai @ iki.fi
/// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
@@ -10,8 +10,8 @@
/// whenever necessary.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai @ iki.fi
/// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
@@ -48,6 +48,9 @@
#include "FIFOSamplePipe.h"
namespace soundtouch
{
/// Sample buffer working in FIFO (first-in-first-out) principle. The class takes
/// care of storage size adjustment and data moving during input/output operations.
///
@@ -57,11 +60,11 @@ class FIFOSampleBuffer : public FIFOSamplePipe
{
private:
/// Sample buffer.
soundtouch::SAMPLETYPE *buffer;
SAMPLETYPE *buffer;
// Raw unaligned buffer memory. 'buffer' is made aligned by pointing it to first
// 16-byte aligned location of this buffer
soundtouch::SAMPLETYPE *bufferUnaligned;
SAMPLETYPE *bufferUnaligned;
/// Sample buffer size in bytes
uint sizeInBytes;
@@ -95,7 +98,7 @@ class FIFOSampleBuffer : public FIFOSamplePipe
);
/// destructor
virtual ~FIFOSampleBuffer();
~FIFOSampleBuffer();
/// Returns a pointer to the beginning of the output samples.
/// This function is provided for accessing the output samples directly.
@@ -104,7 +107,7 @@ class FIFOSampleBuffer : public FIFOSamplePipe
/// When using this function to output samples, also remember to 'remove' the
/// output samples from the buffer by calling the
/// 'receiveSamples(numSamples)' function
virtual soundtouch::SAMPLETYPE *ptrBegin() const;
virtual SAMPLETYPE *ptrBegin() const;
/// Returns a pointer to the end of the used part of the sample buffer (i.e.
/// where the new samples are to be inserted). This function may be used for
@@ -114,7 +117,7 @@ class FIFOSampleBuffer : public FIFOSamplePipe
/// When using this function as means for inserting new samples, also remember
/// to increase the sample count afterwards, by calling the
/// 'putSamples(numSamples)' function.
soundtouch::SAMPLETYPE *ptrEnd(
SAMPLETYPE *ptrEnd(
uint slackCapacity ///< How much free capacity (in samples) there _at least_
///< should be so that the caller can succesfully insert the
///< desired samples to the buffer. If necessary, the function
@@ -123,7 +126,7 @@ class FIFOSampleBuffer : public FIFOSamplePipe
/// Adds 'numSamples' pcs of samples from the 'samples' memory position to
/// the sample buffer.
virtual void putSamples(const soundtouch::SAMPLETYPE *samples, ///< Pointer to samples.
virtual void putSamples(const SAMPLETYPE *samples, ///< Pointer to samples.
uint numSamples ///< Number of samples to insert.
);
@@ -141,7 +144,7 @@ class FIFOSampleBuffer : public FIFOSamplePipe
/// 'numsample' samples in the buffer, returns all that available.
///
/// \return Number of samples returned.
virtual uint receiveSamples(soundtouch::SAMPLETYPE *output, ///< Buffer where to copy output samples.
virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to copy output samples.
uint maxSamples ///< How many samples to receive at max.
);
@@ -166,4 +169,6 @@ class FIFOSampleBuffer : public FIFOSamplePipe
virtual void clear();
};
}
#endif
@@ -5,8 +5,8 @@
/// alias filtering should be quite adequate for this application)
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai @ iki.fi
/// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
@@ -49,23 +49,22 @@
using namespace soundtouch;
/// A linear samplerate transposer class that uses integer arithmetics.
/// for the transposing.
class RateTransposerInteger : public RateTransposer
{
protected:
int iSlopeCount;
uint uRate;
soundtouch::SAMPLETYPE sPrevSampleL, sPrevSampleR;
SAMPLETYPE sPrevSampleL, sPrevSampleR;
virtual void resetRegisters();
virtual uint transposeStereo(soundtouch::SAMPLETYPE *dest,
const soundtouch::SAMPLETYPE *src,
virtual uint transposeStereo(SAMPLETYPE *dest,
const SAMPLETYPE *src,
uint numSamples);
virtual uint transposeMono(soundtouch::SAMPLETYPE *dest,
const soundtouch::SAMPLETYPE *src,
virtual uint transposeMono(SAMPLETYPE *dest,
const SAMPLETYPE *src,
uint numSamples);
public:
@@ -86,15 +85,15 @@ class RateTransposerFloat : public RateTransposer
protected:
float fSlopeCount;
float fRateStep;
soundtouch::SAMPLETYPE sPrevSampleL, sPrevSampleR;
SAMPLETYPE sPrevSampleL, sPrevSampleR;
virtual void resetRegisters();
virtual uint transposeStereo(soundtouch::SAMPLETYPE *dest,
const soundtouch::SAMPLETYPE *src,
virtual uint transposeStereo(SAMPLETYPE *dest,
const SAMPLETYPE *src,
uint numSamples);
virtual uint transposeMono(soundtouch::SAMPLETYPE *dest,
const soundtouch::SAMPLETYPE *src,
virtual uint transposeMono(SAMPLETYPE *dest,
const SAMPLETYPE *src,
uint numSamples);
public:
@@ -3,8 +3,8 @@
/// Common type definitions for SoundTouch audio processing library.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai @ iki.fi
/// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
@@ -45,7 +45,7 @@ typedef unsigned long ulong;
#ifndef _WINDEF_
// if these aren't defined already by Windows headers, define now
typedef unsigned int BOOL;
typedef int BOOL;
#define FALSE 0
#define TRUE 1
@@ -55,12 +55,31 @@ typedef unsigned long ulong;
namespace soundtouch
{
/// Enable one of the following defines to choose either 16bit integer or
/// 32bit float sample type. If you don't have opinion, using integer samples
/// is generally faster.
#define INTEGER_SAMPLES //< 16bit integer samples
//#define FLOAT_SAMPLES //< 32bit float samples
/// Activate these undef's to overrule the possible sampletype
/// setting inherited from some other header file:
//#undef INTEGER_SAMPLES
//#undef FLOAT_SAMPLES
#if !(INTEGER_SAMPLES || FLOAT_SAMPLES)
/// Choose either 32bit floating point or 16bit integer sampletype
/// by choosing one of the following defines, unless this selection
/// has already been done in some other file.
////
/// Notes:
/// - In Windows environment, choose the sample format with the
/// following defines.
/// - In GNU environment, the floating point samples are used by
/// default, but integer samples can be chosen by giving the
/// following switch to the configure script:
/// ./configure --enable-integer-samples
/// However, if you still prefer to select the sample format here
/// also in GNU environment, then please #undef the INTEGER_SAMPLE
/// and FLOAT_SAMPLE defines first as in comments above.
#define INTEGER_SAMPLES 1 //< 16bit integer samples
//#define FLOAT_SAMPLES 1 //< 32bit float samples
#endif
/// Define this to allow CPU-specific assembler optimizations. Notice that
/// having this enabled on non-x86 platforms doesn't matter; the compiler can
@@ -71,6 +90,12 @@ namespace soundtouch
#define ALLOW_OPTIMIZATIONS 1
// If defined, allows the SIMD-optimized routines to take minor shortcuts
// for improved performance. Undefine to require faithfully similar SIMD
// calculations as in normal C implementation.
#define ALLOW_NONEXACT_SIMD_OPTIMIZATION 1
#ifdef INTEGER_SAMPLES
// 16bit integer sample type
typedef short SAMPLETYPE;
@@ -97,11 +122,14 @@ namespace soundtouch
typedef double LONG_SAMPLETYPE;
#ifdef ALLOW_OPTIMIZATIONS
#ifdef WIN32
// Allow 3DNow! and SSE optimizations
#if WIN32
#define ALLOW_3DNOW 1
#endif
#if WIN32 || __MMX__ || MMX
#define ALLOW_SSE 1
#endif // WIN32
#endif
#endif
#endif // INTEGER_SAMPLES
@@ -36,8 +36,8 @@
/// combining the two other controls.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai @ iki.fi
/// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
@@ -298,6 +298,7 @@ void SoundTouch::putSamples(const SAMPLETYPE *samples, uint numSamples)
}
// Transpose the rate of the new samples if necessary
/* Bypass the nominal setting - can introduce a click in sound when tempo/pitch control crosses the nominal value...
if (rate == 1.0f)
{
// The rate value is same as the original, simply evaluate the tempo changer.
@@ -310,7 +311,8 @@ void SoundTouch::putSamples(const SAMPLETYPE *samples, uint numSamples)
}
pTDStretch->putSamples(samples, numSamples);
}
else if (rate < 1.0f)
*/
else if (rate <= 1.0f)
{
// transpose the rate down, output the transposed sound to tempo changer buffer
assert(output == pTDStretch);
@@ -36,8 +36,8 @@
/// combining the two other controls.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai @ iki.fi
/// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
@@ -79,10 +79,10 @@ namespace soundtouch
{
/// Soundtouch library version string
#define SOUNDTOUCH_VERSION "1.3.0"
#define SOUNDTOUCH_VERSION "1.3.1"
/// SoundTouch library version id
#define SOUNDTOUCH_VERSION_ID 010300
#define SOUNDTOUCH_VERSION_ID 010301
//
// Available setting IDs for the 'setSetting' & 'get_setting' functions:
@@ -209,7 +209,7 @@ protected :
/// the input of the object. Notice that sample rate _has_to_ be set before
/// calling this function, otherwise throws a runtime_error exception.
virtual void putSamples(
const soundtouch::SAMPLETYPE *samples, ///< Pointer to sample buffer.
const SAMPLETYPE *samples, ///< Pointer to sample buffer.
uint numSamples ///< Number of samples in buffer. Notice
///< that in case of stereo-sound a single sample
///< contains data for both channels.
@@ -7,8 +7,8 @@
/// of this file.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai @ iki.fi
/// SoundTouch WWW: http://www.iki.fi/oparviai/soundtouch
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//

0 comments on commit 14a7fbf

Please sign in to comment.