|
TracktionEngine
|
Sample buffer working in FIFO (first-in-first-out) principle. More...
#include <tracktion_TempoDetect.h>
Public Member Functions | |
| FIFOSampleBuffer (int numChannels=2) | |
| Constructor. | |
| ~FIFOSampleBuffer () | |
| destructor | |
| virtual SAMPLETYPE * | ptrBegin () |
| Returns a pointer to the beginning of the output samples. | |
| SAMPLETYPE * | ptrEnd (uint slackCapacity) |
| Returns a pointer to the end of the used part of the sample buffer (i.e. | |
| virtual void | putSamples (const SAMPLETYPE *samples, uint numSamples) |
| Adds 'numSamples' pcs of samples from the 'samples' memory position to the sample buffer. | |
| virtual void | putSamples (uint numSamples) |
| Adjusts the book-keeping to increase number of samples in the buffer without copying any actual samples. | |
| virtual uint | receiveSamples (SAMPLETYPE *output, uint maxSamples) |
| Output samples from beginning of the sample buffer. | |
| virtual uint | receiveSamples (uint maxSamples) |
| Adjusts book-keeping so that given number of samples are removed from beginning of the sample buffer without copying them anywhere. | |
| virtual uint | numSamples () const |
| Returns number of samples currently available. | |
| void | setChannels (int numChannels) |
| Sets number of channels, 1 = mono, 2 = stereo. | |
| int | getChannels () |
| Get number of channels. | |
| virtual int | isEmpty () const |
| Returns nonzero if there aren't any samples available for outputting. | |
| virtual void | clear () |
| Clears all the samples. | |
| uint | adjustAmountOfSamples (uint numSamples) |
| allow trimming (downwards) amount of samples in pipeline. | |
| Public Member Functions inherited from engine::soundtouch::FIFOSamplePipe | |
| virtual | ~FIFOSamplePipe () |
| void | moveSamples (FIFOSamplePipe &other) |
Additional Inherited Members | |
| Protected Member Functions inherited from engine::soundtouch::FIFOSamplePipe | |
| bool | verifyNumberOfChannels (int nChannels) const |
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.
Notice that in case of stereo audio, one sample is considered to consist of both channel data.
| engine::soundtouch::FIFOSampleBuffer::FIFOSampleBuffer | ( | int | numChannels = 2 | ) |
Constructor.
| numChannels | Number of channels, 1=mono, 2=stereo. Default is stereo. |
| engine::soundtouch::FIFOSampleBuffer::~FIFOSampleBuffer | ( | ) |
destructor
|
virtual |
Returns a pointer to the beginning of the output samples.
This function is provided for accessing the output samples directly. Please be careful for not to corrupt the book-keeping!
When using this function to output samples, also remember to 'remove' the output samples from the buffer by calling the 'receiveSamples(numSamples)' function
Implements engine::soundtouch::FIFOSamplePipe.
| SAMPLETYPE * engine::soundtouch::FIFOSampleBuffer::ptrEnd | ( | uint | slackCapacity | ) |
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 inserting new samples into the sample buffer directly. Please be careful not corrupt the book-keeping!
When using this function as means for inserting new samples, also remember to increase the sample count afterwards, by calling the 'putSamples(numSamples)' function.
| slackCapacity | How much free capacity (in samples) there at least should be so that the caller can successfully insert the desired samples to the buffer. If necessary, the function grows the buffer size to comply with this requirement. |
|
virtual |
Adds 'numSamples' pcs of samples from the 'samples' memory position to the sample buffer.
| samples | Pointer to samples. |
| numSamples | Number of samples to insert. |
Implements engine::soundtouch::FIFOSamplePipe.
|
virtual |
Adjusts the book-keeping to increase number of samples in the buffer without copying any actual samples.
This function is used to update the number of samples in the sample buffer when accessing the buffer directly with 'ptrEnd' function. Please be careful though!
| numSamples | Number of samples been inserted. |
References numSamples().
|
virtual |
Output samples from beginning of the sample buffer.
Copies requested samples to output buffer and removes them from the sample buffer. If there are less than 'numsample' samples in the buffer, returns all that available.
| output | Buffer where to copy output samples. |
| maxSamples | How many samples to receive at max. |
Implements engine::soundtouch::FIFOSamplePipe.
Adjusts book-keeping so that given number of samples are removed from beginning of the sample buffer without copying them anywhere.
Used to reduce the number of samples in the buffer when accessing the sample buffer directly with 'ptrBegin' function.
| maxSamples | Remove this many samples from the beginning of pipe. |
Implements engine::soundtouch::FIFOSamplePipe.
|
virtual |
Returns number of samples currently available.
Implements engine::soundtouch::FIFOSamplePipe.
Referenced by putSamples().
| void engine::soundtouch::FIFOSampleBuffer::setChannels | ( | int | numChannels | ) |
Sets number of channels, 1 = mono, 2 = stereo.
| int engine::soundtouch::FIFOSampleBuffer::getChannels | ( | ) |
Get number of channels.
|
virtual |
Returns nonzero if there aren't any samples available for outputting.
Implements engine::soundtouch::FIFOSamplePipe.
|
virtual |
Clears all the samples.
Implements engine::soundtouch::FIFOSamplePipe.
allow trimming (downwards) amount of samples in pipeline.
Returns adjusted amount of samples
Implements engine::soundtouch::FIFOSamplePipe.