soundtouch::TDStretch Class Reference

#include <TDStretch.h>

Inheritance diagram for soundtouch::TDStretch:

FIFOProcessor FIFOSamplePipe soundtouch::TDStretch3DNow soundtouch::TDStretchMMX soundtouch::TDStretchSSE

List of all members.


Detailed Description

Class that does the time-stretch (tempo change) effect for the processed sound.

Definition at line 97 of file TDStretch.h.


Public Member Functions

 TDStretch ()
virtual ~TDStretch ()
void * operator new (size_t s)
 Operator 'new' is overloaded so that it automatically creates a suitable instance depending on if we've a MMX/SSE/etc-capable CPU available or not.
FIFOSamplePipegetOutput ()
 Returns the output buffer object.
FIFOSamplePipegetInput ()
 Returns the input buffer object.
void setTempo (float newTempo)
 Sets new target tempo.
virtual void clear ()
 Returns nonzero if there aren't any samples available for outputting.
void clearInput ()
 Clears the input buffer.
void setChannels (uint numChannels)
 Sets the number of channels, 1 = mono, 2 = stereo.
void enableQuickSeek (BOOL enable)
 Enables/disables the quick position seeking algorithm.
BOOL isQuickSeekEnabled () const
 Returns nonzero if the quick seeking algorithm is enabled.
void setParameters (uint sampleRate, uint sequenceMS=DEFAULT_SEQUENCE_MS, uint seekwindowMS=DEFAULT_SEEKWINDOW_MS, uint overlapMS=DEFAULT_OVERLAP_MS)
 Sets routine control parameters.
void getParameters (uint *pSampleRate, uint *pSequenceMs, uint *pSeekWindowMs, uint *pOverlapMs)
 Get routine control parameters, see setParameters() function.
virtual void putSamples (const SAMPLETYPE *samples, uint numSamples)
 Adds 'numsamples' pcs of samples from the 'samples' memory position into the input of the object.

Static Public Member Functions

static TDStretchnewInstance ()
 Use this function instead of "new" operator to create a new instance of this class.

Protected Member Functions

void acceptNewOverlapLength (uint newOverlapLength)
 Set new overlap length parameter & reallocate RefMidBuffer if necessary.
virtual void clearCrossCorrState ()
 clear cross correlation routine state if necessary
void calculateOverlapLength (uint overlapMs)
 Calculates overlap period length in samples.
virtual LONG_SAMPLETYPE calcCrossCorrMulti (const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare) const
virtual LONG_SAMPLETYPE calcCrossCorrStereo (const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare) const
virtual LONG_SAMPLETYPE calcCrossCorrMono (const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare) const
virtual uint seekBestOverlapPositionMulti (const SAMPLETYPE *refPos)
virtual uint seekBestOverlapPositionMultiQuick (const SAMPLETYPE *refPos)
virtual uint seekBestOverlapPositionStereo (const SAMPLETYPE *refPos)
virtual uint seekBestOverlapPositionStereoQuick (const SAMPLETYPE *refPos)
virtual uint seekBestOverlapPositionMono (const SAMPLETYPE *refPos)
virtual uint seekBestOverlapPositionMonoQuick (const SAMPLETYPE *refPos)
uint seekBestOverlapPosition (const SAMPLETYPE *refPos)
virtual void overlapMulti (SAMPLETYPE *output, const SAMPLETYPE *input) const
virtual void overlapStereo (SAMPLETYPE *output, const SAMPLETYPE *input) const
virtual void overlapMono (SAMPLETYPE *output, const SAMPLETYPE *input) const
void clearMidBuffer ()
void overlap (SAMPLETYPE *output, const SAMPLETYPE *input, uint ovlPos) const
void precalcCorrReference ()
void precalcCorrReferenceMono ()
void precalcCorrReferenceStereo ()
void processNominalTempo ()
void processSamples ()
 Changes the tempo of the given sound samples.

Protected Attributes

uint channels
uint sampleReq
float tempo
SAMPLETYPEpMidBuffer
SAMPLETYPEpRefMidBuffer
SAMPLETYPEpRefMidBufferUnaligned
uint midBufferLength
uint overlapLength
uint overlapDividerBits
uint slopingDivider
uint seekLength
uint seekWindowLength
uint maxOffset
float nominalSkip
float skipFract
FIFOSampleBuffer outputBuffer
FIFOSampleBuffer inputBuffer
BOOL bQuickseek
BOOL bMidBufferDirty
uint sampleRate
uint sequenceMs
uint seekWindowMs
uint overlapMs

Constructor & Destructor Documentation

TDStretch::TDStretch (  ) 

Definition at line 91 of file TDStretch.cpp.

TDStretch::~TDStretch (  )  [virtual]

Definition at line 110 of file TDStretch.cpp.


Member Function Documentation

void TDStretch::acceptNewOverlapLength ( uint  newOverlapLength  )  [protected]

Set new overlap length parameter & reallocate RefMidBuffer if necessary.

Definition at line 764 of file TDStretch.cpp.

Referenced by calculateOverlapLength().

void TDStretch::clearCrossCorrState (  )  [protected, virtual]

void TDStretch::calculateOverlapLength ( uint  overlapMs  )  [protected]

Calculates overlap period length in samples.

Integer version rounds overlap length to closest power of 2 for a divide scaling operation.

Definition at line 953 of file TDStretch.cpp.

Referenced by setParameters().

long TDStretch::calcCrossCorrMulti ( const SAMPLETYPE mixingPos,
const SAMPLETYPE compare 
) const [protected, virtual]

Reimplemented in soundtouch::TDStretchMMX.

Definition at line 1002 of file TDStretch.cpp.

Referenced by seekBestOverlapPositionMulti(), and seekBestOverlapPositionMultiQuick().

long TDStretch::calcCrossCorrStereo ( const SAMPLETYPE mixingPos,
const SAMPLETYPE compare 
) const [protected, virtual]

Reimplemented in soundtouch::TDStretchMMX.

Definition at line 986 of file TDStretch.cpp.

Referenced by seekBestOverlapPositionStereo(), and seekBestOverlapPositionStereoQuick().

long TDStretch::calcCrossCorrMono ( const SAMPLETYPE mixingPos,
const SAMPLETYPE compare 
) const [protected, virtual]

Definition at line 971 of file TDStretch.cpp.

Referenced by seekBestOverlapPositionMono(), and seekBestOverlapPositionMonoQuick().

uint TDStretch::seekBestOverlapPositionMulti ( const SAMPLETYPE refPos  )  [protected, virtual]

Definition at line 322 of file TDStretch.cpp.

Referenced by seekBestOverlapPosition().

uint TDStretch::seekBestOverlapPositionMultiQuick ( const SAMPLETYPE refPos  )  [protected, virtual]

Definition at line 362 of file TDStretch.cpp.

Referenced by seekBestOverlapPosition().

uint TDStretch::seekBestOverlapPositionStereo ( const SAMPLETYPE refPos  )  [protected, virtual]

Definition at line 418 of file TDStretch.cpp.

Referenced by seekBestOverlapPosition().

uint TDStretch::seekBestOverlapPositionStereoQuick ( const SAMPLETYPE refPos  )  [protected, virtual]

Definition at line 458 of file TDStretch.cpp.

Referenced by seekBestOverlapPosition().

uint TDStretch::seekBestOverlapPositionMono ( const SAMPLETYPE refPos  )  [protected, virtual]

Definition at line 515 of file TDStretch.cpp.

Referenced by seekBestOverlapPosition().

uint TDStretch::seekBestOverlapPositionMonoQuick ( const SAMPLETYPE refPos  )  [protected, virtual]

Definition at line 558 of file TDStretch.cpp.

Referenced by seekBestOverlapPosition().

uint TDStretch::seekBestOverlapPosition ( const SAMPLETYPE refPos  )  [protected]

Definition at line 245 of file TDStretch.cpp.

Referenced by processSamples().

void TDStretch::overlapMulti ( SAMPLETYPE output,
const SAMPLETYPE input 
) const [protected, virtual]

Definition at line 931 of file TDStretch.cpp.

Referenced by overlap().

void TDStretch::overlapStereo ( SAMPLETYPE output,
const SAMPLETYPE input 
) const [protected, virtual]

Reimplemented in soundtouch::TDStretchMMX.

Definition at line 913 of file TDStretch.cpp.

Referenced by overlap().

void TDStretch::overlapMono ( SAMPLETYPE output,
const SAMPLETYPE input 
) const [protected, virtual]

Definition at line 189 of file TDStretch.cpp.

Referenced by overlap().

void TDStretch::clearMidBuffer (  )  [protected]

Definition at line 202 of file TDStretch.cpp.

Referenced by acceptNewOverlapLength(), clear(), clearInput(), and processNominalTempo().

void TDStretch::overlap ( SAMPLETYPE output,
const SAMPLETYPE input,
uint  ovlPos 
) const [inline, protected]

Definition at line 293 of file TDStretch.cpp.

Referenced by processNominalTempo(), and processSamples().

void TDStretch::precalcCorrReference (  )  [protected]

void TDStretch::precalcCorrReferenceMono (  )  [protected]

Definition at line 896 of file TDStretch.cpp.

Referenced by seekBestOverlapPositionMono(), and seekBestOverlapPositionMonoQuick().

void TDStretch::precalcCorrReferenceStereo (  )  [protected]

void TDStretch::processNominalTempo (  )  [protected]

Definition at line 653 of file TDStretch.cpp.

Referenced by processSamples().

void TDStretch::processSamples (  )  [protected]

Changes the tempo of the given sound samples.

Returns amount of samples returned in the "output" buffer. The maximum amount of samples that can be returned at a time is set by the 'set_returnBuffer_size' function.

Definition at line 684 of file TDStretch.cpp.

Referenced by putSamples().

void * TDStretch::operator new ( size_t  s  ) 

Operator 'new' is overloaded so that it automatically creates a suitable instance depending on if we've a MMX/SSE/etc-capable CPU available or not.

Definition at line 791 of file TDStretch.cpp.

TDStretch * TDStretch::newInstance (  )  [static]

Use this function instead of "new" operator to create a new instance of this class.

This function automatically chooses a correct feature set depending on if the CPU supports MMX/SSE/etc extensions.

Definition at line 799 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::SoundTouch().

FIFOSamplePipe* soundtouch::TDStretch::getOutput (  )  [inline]

Returns the output buffer object.

Definition at line 184 of file TDStretch.h.

Referenced by soundtouch::SoundTouch::calcEffectiveRateAndTempo().

FIFOSamplePipe* soundtouch::TDStretch::getInput (  )  [inline]

Returns the input buffer object.

Definition at line 187 of file TDStretch.h.

Referenced by soundtouch::SoundTouch::calcEffectiveRateAndTempo(), and soundtouch::SoundTouch::numUnprocessedSamples().

void TDStretch::setTempo ( float  newTempo  ) 

Sets new target tempo.

Normal tempo = 'SCALE', smaller values represent slower tempo, larger faster tempo.

Definition at line 617 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::calcEffectiveRateAndTempo(), setParameters(), and TDStretch().

void TDStretch::clear (  )  [virtual]

Returns nonzero if there aren't any samples available for outputting.

Implements FIFOSamplePipe.

Definition at line 220 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::clear().

void TDStretch::clearInput (  ) 

Clears the input buffer.

Definition at line 212 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::flush().

void TDStretch::setChannels ( uint  numChannels  ) 

Sets the number of channels, 1 = mono, 2 = stereo.

Definition at line 636 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::setChannels().

void TDStretch::enableQuickSeek ( BOOL  enable  ) 

Enables/disables the quick position seeking algorithm.

Zero to disable, nonzero to enable

Definition at line 231 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::setSetting().

BOOL TDStretch::isQuickSeekEnabled (  )  const

Returns nonzero if the quick seeking algorithm is enabled.

Definition at line 238 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::getSetting().

void TDStretch::setParameters ( uint  sampleRate,
uint  sequenceMS = DEFAULT_SEQUENCE_MS,
uint  seekwindowMS = DEFAULT_SEEKWINDOW_MS,
uint  overlapMS = DEFAULT_OVERLAP_MS 
)

Sets routine control parameters.

These control are certain time constants defining how the sound is stretched to the desired duration. 'sampleRate' = sample rate of the sound 'sequenceMS' = one processing sequence length in milliseconds 'seekwindowMS' = seeking window length for scanning the best overlapping position 'overlapMS' = overlapping length

Parameters:
sampleRate  Samplerate of sound being processed (Hz)
sequenceMS  Single processing sequence length (ms)
seekwindowMS  Offset seeking window length (ms)
overlapMS  Sequence overlapping length (ms)

Definition at line 139 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::setSampleRate(), soundtouch::SoundTouch::setSetting(), and TDStretch().

void TDStretch::getParameters ( uint pSampleRate,
uint pSequenceMs,
uint pSeekWindowMs,
uint pOverlapMs 
)

Get routine control parameters, see setParameters() function.

Any of the parameters to this function can be NULL, in such case corresponding parameter value isn't returned.

Any of the parameters to this function can be NULL, in such case corresponding parameter value isn't returned.

Definition at line 164 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::getSetting(), and soundtouch::SoundTouch::setSetting().

void TDStretch::putSamples ( const SAMPLETYPE samples,
uint  numSamples 
) [virtual]

Adds 'numsamples' pcs of samples from the 'samples' memory position into the input of the object.

Parameters:
samples  Input sample data
numSamples  Number of samples in 'samples' so that one sample contains both channels if stereo

Implements FIFOSamplePipe.

Definition at line 753 of file TDStretch.cpp.

Referenced by soundtouch::SoundTouch::putSamples().


Member Data Documentation

Definition at line 101 of file TDStretch.h.

Referenced by processSamples(), and setTempo().

float soundtouch::TDStretch::tempo [protected]

Definition at line 102 of file TDStretch.h.

Referenced by processNominalTempo(), processSamples(), setParameters(), and setTempo().

Definition at line 106 of file TDStretch.h.

Referenced by acceptNewOverlapLength(), TDStretch(), and ~TDStretch().

Definition at line 107 of file TDStretch.h.

Referenced by acceptNewOverlapLength(), clearMidBuffer(), TDStretch(), and ~TDStretch().

Definition at line 112 of file TDStretch.h.

Referenced by processSamples(), setParameters(), and setTempo().

Definition at line 113 of file TDStretch.h.

Referenced by setParameters(), and setTempo().

Definition at line 114 of file TDStretch.h.

Referenced by processSamples(), and setTempo().

Definition at line 115 of file TDStretch.h.

Referenced by processSamples(), and setTempo().

Definition at line 116 of file TDStretch.h.

Referenced by clear(), getOutput(), processNominalTempo(), processSamples(), and setChannels().

Definition at line 121 of file TDStretch.h.

Referenced by calculateOverlapLength(), getParameters(), and setParameters().

Definition at line 122 of file TDStretch.h.

Referenced by getParameters(), and setParameters().

Definition at line 123 of file TDStretch.h.

Referenced by getParameters(), and setParameters().

Definition at line 124 of file TDStretch.h.

Referenced by getParameters(), and setParameters().


The documentation for this class was generated from the following files:

Generated on Sat Dec 18 05:16:15 2010 for MythTV by  doxygen 1.5.5