|
MythTV
0.26-pre
|
A common linear samplerate transposer class. More...
#include <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. | |
| FIFOSamplePipe * | getOutput () |
| Returns the output buffer object. | |
| FIFOSamplePipe * | getStore () |
| Returns the store buffer object. | |
| AAFilter * | getAAFilter () 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 RateTransposer * | newInstance () |
| 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 | |
| AAFilter * | pAAFilter |
| 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 |
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.
Definition at line 133 of file RateTransposer.cpp.
| RateTransposer::~RateTransposer | ( | ) | [virtual] |
Definition at line 146 of file RateTransposer.cpp.
| void soundtouch::RateTransposer::init | ( | ) | [protected] |
| 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().
| void RateTransposer::flushStoreBuffer | ( | ) | [protected] |
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.
| 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 167 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 154 of file RateTransposer.cpp.
Referenced by soundtouch::SoundTouch::setSetting().
| BOOL RateTransposer::isAAFilterEnabled | ( | ) | const |
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().
| void RateTransposer::setChannels | ( | uint | channels | ) |
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().
AAFilter* soundtouch::RateTransposer::pAAFilter [protected] |
Anti-alias filter object.
Definition at line 67 of file RateTransposer.h.
Referenced by downsample(), getAAFilter(), processSamples(), RateTransposer(), setRate(), upsample(), and ~RateTransposer().
float soundtouch::RateTransposer::fRate [protected] |
Definition at line 69 of file RateTransposer.h.
Referenced by downsample(), processSamples(), RateTransposer(), setRate(), RateTransposerFloat::transposeMono(), RateTransposerFloat::transposeStereo(), and upsample().
uint soundtouch::RateTransposer::uChannels [protected] |
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().
BOOL soundtouch::RateTransposer::bUseAAFilter [protected] |
Definition at line 83 of file RateTransposer.h.
Referenced by enableAAFilter(), isAAFilterEnabled(), processSamples(), and RateTransposer().
1.7.6.1