#include <aflibAudioSampleRateCvt.h>
Inheritance diagram for aflibAudioSampleRateCvt::
Public Methods | |
aflibAudioSampleRateCvt (aflibAudio &audio, double factor, bool linear_interpolation=FALSE, bool high_quality=FALSE, bool filter_interpolation=FALSE) | |
Basic constructor to place object in a chain. More... | |
~aflibAudioSampleRateCvt () | |
Destructor. | |
void | setFactor (double factor, double volume=1.0) |
Sets the sample rate conversion factor. More... | |
void | setInputConfig (const aflibConfig &cfg) |
Sets the input and output audio data configuration of this object. More... | |
const char* | getName () const |
Returns the name of the derived class. | |
aflibStatus | compute_segment (list< aflibData *> &data, long long position=-1) |
Performs the sample rate conversion of a segment of data. More... | |
aflibData* | process (aflibStatus &ret_status, long long position, int &num_samples, bool free_memory=TRUE) |
Performs some needed preprocessing before base class function is called. More... | |
bool | isDataSizeSupported (aflib_data_size size) |
Inform base class that this object only supports 16bit signed data. More... |
This class is a wrapper class around the audio rate converter class (ie aflibConverter). This class provides data to the converter class and keeps the audio data streaming. This is needed for file formats that don't have random access and for reading from devices. This class can use the aflibMemCache base class to perform audio caching. This class will provide sample rate conversion by virtually any factor as well as set the quality of the conversion.
|
Basic constructor to place object in a chain. Different sampling methods can be employed. By setting linear_interpolation to TRUE you are selecting the fastest and least quality method of sampling. With this set to TRUE the high_quality and filter_interpolation have no effect. This method just does a simple interpolation process when resampling occurs. Thus alias distoration can occur with this mode. To use high quality resampling the linear_interpolation flag should be set to FALSE. With linear_interpolation set to FALSE then the high_quality flag can be set. If it is set to FALSE then a small filter will be used. If TRUE a large filter will be used. The large filter is the best quality and also is the most CPU intensive. For most applications the small filter should be more than adequate. With the small and large filter a third parameter can be set, filter_interpolation. With filter_interpolation set then the filter coefficients used for both the small and large filtering will be interpolated as well. Defaults for the 3 filter parameters are set in the constructor which will create a small filter. This should be sufficient for most cases. For a description of factor see the setFactor member function description. |
|
Destructor.
|
|
Performs the sample rate conversion of a segment of data. This is the function that does all the work. It does many things. It takes an input buffer of data from its parent and adds it to the end of any previously unused data from the previous pass. This is done so that data can be streamed. The new data is sent to the converter. The convertered data is then saved to the output buffer to be returned to the next object. Any unused data is saved for the next pass. NOTE: one can disable the caching in the aflibMemCache base class, which is enabled by default for this class, and instead use a simple caching implemented in this function. Reimplemented from aflibAudio. |
|
Returns the name of the derived class.
Reimplemented from aflibAudio. Reimplemented in aflibAudioPitch. |
|
Inform base class that this object only supports 16bit signed data. This overrides the virtual function in the base class. This algorithm works only on 16 bit signed data. Base class must convert the data. Reimplemented from aflibAudio. |
|
Performs some needed preprocessing before base class function is called. This function will take the position and number of samples requested and based on several factors will determine what position and number of samples is required from its parent. It will also try as best as possible to keep the data streaming. This is so it can read from a device or a format that does not have random access. When this function is done it will call the aflibAudio base classes function of the same name. Reimplemented from aflibAudio. |
|
Sets the sample rate conversion factor. This will set the sample rate conversion factor. Virtually any value, within reason, can be set. For instance to convert 22050 to 44100 a factor of 0.5 should be used. To convert 44100 to 22050 a factor of 2.0 should be used. This will change the factor that was set in the constructor. This function can also be used to change the final amplitude. This only applies to the small and large filters and not the linear mode. |
|
Sets the input and output audio data configuration of this object. This function overrides the aflibAudio base class function. It will change the output rate sample rate in the output audio configuration. Reimplemented from aflibAudio. Reimplemented in aflibAudioPitch. |