soundtouch::RateTransposer Class Reference

#include <RateTransposer.h>

Inheritance diagram for soundtouch::RateTransposer:

FIFOProcessor FIFOSamplePipe RateTransposerFloat RateTransposerInteger

List of all members.


Detailed Description

A common linear samplerate transposer class.

Note: Use function "RateTransposer::newInstance()" to create a new class instance instead of the "new" operator; that function automatically chooses a correct implementation depending on if integer or floating arithmetics are to be used.

Definition at line 63 of file RateTransposer.h.


Public Member Functions

 RateTransposer ()
virtual ~RateTransposer ()
void * operator new (size_t s)
 Operator 'new' is overloaded so that it automatically creates a suitable instance depending on if we're to use integer or floating point arithmetics.
FIFOSamplePipegetOutput ()
 Returns the output buffer object.
FIFOSamplePipegetStore ()
 Returns the store buffer object.
AAFiltergetAAFilter () const
 Return anti-alias filter object.
void enableAAFilter (BOOL newMode)
 Enables/disables the anti-alias filter. Zero to disable, nonzero to enable.
BOOL isAAFilterEnabled () const
 Returns nonzero if anti-alias filter is enabled.
virtual void setRate (float newRate)
 Sets new target rate.
void setChannels (uint channels)
 Sets the number of channels, 1 = mono, 2 = stereo.
void putSamples (const soundtouch::SAMPLETYPE *samples, uint numSamples)
 Adds 'numSamples' pcs of samples from the 'samples' memory position into the input of the object.
void clear ()
 Clears all the samples in the object.
uint isEmpty ()
 Returns nonzero if there aren't any samples available for outputting.

Static Public Member Functions

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

Protected Member Functions

void init ()
virtual void resetRegisters ()=0
virtual uint transposeStereo (soundtouch::SAMPLETYPE *dest, const soundtouch::SAMPLETYPE *src, uint numSamples)=0
virtual uint transposeMono (soundtouch::SAMPLETYPE *dest, const soundtouch::SAMPLETYPE *src, uint numSamples)=0
uint transpose (soundtouch::SAMPLETYPE *dest, const soundtouch::SAMPLETYPE *src, uint numSamples)
void flushStoreBuffer ()
void downsample (const soundtouch::SAMPLETYPE *src, uint numSamples)
void upsample (const soundtouch::SAMPLETYPE *src, uint numSamples)
void processSamples (const soundtouch::SAMPLETYPE *src, uint numSamples)
 Transposes sample rate by applying anti-alias filter to prevent folding.

Protected Attributes

AAFilterpAAFilter
 Anti-alias filter object.
float fRate
uint uChannels
FIFOSampleBuffer storeBuffer
 Buffer for collecting samples to feed the anti-alias filter between two batches.
FIFOSampleBuffer tempBuffer
 Buffer for keeping samples between transposing & anti-alias filter.
FIFOSampleBuffer outputBuffer
 Output sample buffer.
BOOL bUseAAFilter

Constructor & Destructor Documentation

RateTransposer::RateTransposer (  ) 

Definition at line 133 of file RateTransposer.cpp.

RateTransposer::~RateTransposer (  )  [virtual]

Definition at line 145 of file RateTransposer.cpp.


Member Function Documentation

void soundtouch::RateTransposer::init (  )  [protected]

virtual void soundtouch::RateTransposer::resetRegisters (  )  [protected, pure virtual]

Implemented in RateTransposerInteger, and RateTransposerFloat.

Referenced by setChannels().

virtual uint soundtouch::RateTransposer::transposeStereo ( soundtouch::SAMPLETYPE dest,
const soundtouch::SAMPLETYPE src,
uint  numSamples 
) [protected, pure virtual]

Implemented in RateTransposerInteger, and RateTransposerFloat.

Referenced by transpose().

virtual uint soundtouch::RateTransposer::transposeMono ( soundtouch::SAMPLETYPE dest,
const soundtouch::SAMPLETYPE src,
uint  numSamples 
) [protected, pure virtual]

Implemented in RateTransposerInteger, and RateTransposerFloat.

Referenced by transpose().

uint RateTransposer::transpose ( soundtouch::SAMPLETYPE dest,
const soundtouch::SAMPLETYPE src,
uint  numSamples 
) [inline, protected]

Definition at line 314 of file RateTransposer.cpp.

Referenced by downsample(), processSamples(), and upsample().

void RateTransposer::flushStoreBuffer (  )  [protected]

Definition at line 200 of file RateTransposer.cpp.

void RateTransposer::downsample ( const soundtouch::SAMPLETYPE src,
uint  numSamples 
) [protected]

Definition at line 248 of file RateTransposer.cpp.

Referenced by processSamples().

void RateTransposer::upsample ( const soundtouch::SAMPLETYPE src,
uint  numSamples 
) [protected]

Definition at line 219 of file RateTransposer.cpp.

Referenced by processSamples().

void RateTransposer::processSamples ( const soundtouch::SAMPLETYPE src,
uint  numSamples 
) [protected]

Transposes sample rate by applying anti-alias filter to prevent folding.

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

Definition at line 282 of file RateTransposer.cpp.

Referenced by putSamples().

void * RateTransposer::operator new ( size_t  s  ) 

Operator 'new' is overloaded so that it automatically creates a suitable instance depending on if we're to use integer or floating point arithmetics.

Definition at line 114 of file RateTransposer.cpp.

RateTransposer * RateTransposer::newInstance (  )  [static]

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

This function automatically chooses a correct implementation, depending on if integer ot floating point arithmetics are to be used.

Definition at line 122 of file RateTransposer.cpp.

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

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

Returns the output buffer object.

Definition at line 128 of file RateTransposer.h.

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

FIFOSamplePipe* soundtouch::RateTransposer::getStore (  )  [inline]

Returns the store buffer object.

Definition at line 131 of file RateTransposer.h.

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

AAFilter * RateTransposer::getAAFilter (  )  const

Return anti-alias filter object.

Definition at line 166 of file RateTransposer.cpp.

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

void RateTransposer::enableAAFilter ( BOOL  newMode  ) 

Enables/disables the anti-alias filter. Zero to disable, nonzero to enable.

Definition at line 153 of file RateTransposer.cpp.

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

BOOL RateTransposer::isAAFilterEnabled (  )  const

Returns nonzero if anti-alias filter is enabled.

Definition at line 160 of file RateTransposer.cpp.

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

void RateTransposer::setRate ( float  newRate  )  [virtual]

Sets new target rate.

Normal rate = 1.0, smaller values represent slower rate, larger faster rates.

Reimplemented in RateTransposerInteger.

Definition at line 175 of file RateTransposer.cpp.

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

void RateTransposer::setChannels ( uint  channels  ) 

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

Definition at line 328 of file RateTransposer.cpp.

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

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

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

Implements FIFOSamplePipe.

Definition at line 210 of file RateTransposer.cpp.

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

void RateTransposer::clear (  )  [virtual]

Clears all the samples in the object.

Implements FIFOSamplePipe.

Definition at line 349 of file RateTransposer.cpp.

Referenced by soundtouch::SoundTouch::clear(), and soundtouch::SoundTouch::flush().

uint RateTransposer::isEmpty (  ) 

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

Definition at line 357 of file RateTransposer.cpp.

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


Member Data Documentation

Anti-alias filter object.

Definition at line 67 of file RateTransposer.h.

Referenced by downsample(), getAAFilter(), processSamples(), RateTransposer(), setRate(), upsample(), and ~RateTransposer().

Definition at line 71 of file RateTransposer.h.

Referenced by downsample(), RateTransposer(), setChannels(), transpose(), and upsample().

Buffer for collecting samples to feed the anti-alias filter between two batches.

Definition at line 75 of file RateTransposer.h.

Referenced by clear(), downsample(), flushStoreBuffer(), getStore(), isEmpty(), setChannels(), and upsample().

Buffer for keeping samples between transposing & anti-alias filter.

Definition at line 78 of file RateTransposer.h.

Referenced by downsample(), and setChannels().

Output sample buffer.

Definition at line 81 of file RateTransposer.h.

Referenced by clear(), downsample(), flushStoreBuffer(), getOutput(), processSamples(), setChannels(), and upsample().

Definition at line 83 of file RateTransposer.h.

Referenced by enableAAFilter(), isAAFilterEnabled(), processSamples(), and RateTransposer().


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

Generated on Sat Sep 4 05:16:12 2010 for MythTV by  doxygen 1.5.5