MythTV  0.26-pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
soundtouch::RateTransposer Class Reference

A common linear samplerate transposer class. More...

#include <RateTransposer.h>

Inheritance diagram for soundtouch::RateTransposer:
FIFOProcessor FIFOSamplePipe RateTransposerFloat RateTransposerInteger

List of all members.

Public Member Functions

 RateTransposer ()
virtual ~RateTransposer ()
voidoperator 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.
int isEmpty () const
 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

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.


Constructor & Destructor Documentation

Definition at line 133 of file RateTransposer.cpp.

Definition at line 146 of file RateTransposer.cpp.


Member Function Documentation

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

Implemented in RateTransposerFloat, and RateTransposerInteger.

Referenced by setChannels().

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

Implemented in RateTransposerFloat, and RateTransposerInteger.

Referenced by transpose().

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

Implemented in RateTransposerFloat, and RateTransposerInteger.

Referenced by transpose().

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

Definition at line 315 of file RateTransposer.cpp.

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

Definition at line 201 of file RateTransposer.cpp.

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

Definition at line 249 of file RateTransposer.cpp.

Referenced by processSamples().

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

Definition at line 220 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 283 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.

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().

Returns the output buffer object.

Definition at line 128 of file RateTransposer.h.

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

Returns the store buffer object.

Definition at line 131 of file RateTransposer.h.

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

Return anti-alias filter object.

Definition at line 167 of file RateTransposer.cpp.

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

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

Definition at line 154 of file RateTransposer.cpp.

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

Returns nonzero if anti-alias filter is enabled.

Definition at line 161 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 176 of file RateTransposer.cpp.

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

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

Definition at line 329 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 211 of file RateTransposer.cpp.

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

void RateTransposer::clear ( void  ) [virtual]

Clears all the samples in the object.

Implements FIFOSamplePipe.

Definition at line 350 of file RateTransposer.cpp.

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

int RateTransposer::isEmpty ( ) const [virtual]

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

Reimplemented from FIFOProcessor.

Definition at line 358 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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends