Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

aflibConverter Class Reference

Provides sample rate conversion. More...

#include <aflibConverter.h>

List of all members.

Public Methods

 aflibConverter (bool high_quality, bool linear_interpolation, bool filter_interpolation)
 ~aflibConverter ()
void initialize (double factor, int channels, double volume=1.0)
int resample (int &inCount, int outCount, short inArray[], short outArray[])


Detailed Description

Provides sample rate conversion.

This class will perform audio resampling. With the constructor you can choose the type of resampling to be done. Simple linear interpolation can be done by setting linear_interpolation to be TRUE in the constructor. The other two flags are ignored if this is set. If linear_interpolation is FALSE then some form of filtering will be done. IF high_quality is FALSE then a small filter will be performed. If high_quality is TRUE then a large filter (higher quality) will be performed. For both the small and large filters another parameter can be specified, filter_interpolation. With filter_interpolation set then the filter coefficients used for both the small and large filtering will be interpolated as well.

This class was designed to stream audio data. It also expects audio data as 16 bit values. Each time a new stream is started some initialization needs to be done. Thus the function initialize should be called to initialize everything. This initialize function will set the conversion factor as well as a multiplecation factor for volume. The volume only applies to the small and large filter. Since this filter uses a history of the audio data it is possible for it to vary in amplitude. This allows users to scale the data. This class will work on any number of channels. Once everything is specified then resample should be called as many times as is necessary to process all the data. The value inCount will be returned indicating how many inArray samples were actually used to produce the output. This value can be used to indicate where the next block of inArray data should start. The resample function is driven by the outCount value specified. The inArray should contain at least: outCount / factor + extra_samples. extra_samples depends on the type of filtering done. As a rule of thumb 50 should be adequate for any type of filter.


Constructor & Destructor Documentation

aflibConverter::aflibConverter ( bool high_quality,
bool linear_interpolation,
bool filter_interpolation )
 

aflibConverter::~aflibConverter ( )
 


Member Function Documentation

void aflibConverter::initialize ( double factor,
int channels,
double volume = 1.0 )
 

int aflibConverter::resample ( int & inCount,
int outCount,
short inArray[],
short outArray[] )
 


The documentation for this class was generated from the following file:
Generated at Tue Aug 7 22:18:07 2001 for Open Source Audio Library Project by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001