Logo Search packages:      
Sourcecode: darkice version File versions

aflibConverter Class Reference

#include <aflibConverter.h>

List of all members.


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.

Definition at line 77 of file aflibConverter.h.


Public Member Functions

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

Private Member Functions

 aflibConverter (const aflibConverter &op)
void deleteMemory ()
int err_ret (char *s)
int FilterUD (short Imp[], short ImpD[], unsigned short Nwing, bool Interp, short *Xp, short Ph, short Inc, unsigned short dhb)
int FilterUp (short Imp[], short ImpD[], unsigned short Nwing, bool Interp, short *Xp, short Ph, short Inc)
const aflibConverteroperator= (const aflibConverter &op)
int readData (int inCount, short inArray[], short *outPtr[], int dataArraySize, int Xoff, bool init_count)
int resampleFast (int &inCount, int outCount, short inArray[], short outArray[])
int resampleWithFilter (int &inCount, int outCount, short inArray[], short outArray[], short Imp[], short ImpD[], unsigned short LpScl, unsigned short Nmult, unsigned short Nwing)
int SrcLinear (short X[], short Y[], double factor, unsigned int *Time, unsigned short &Nx, unsigned short Nout)
int SrcUD (short X[], short Y[], double factor, unsigned int *Time, unsigned short &Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp)
int SrcUp (short X[], short Y[], double factor, unsigned int *Time, unsigned short &Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp)
short WordToHword (int v, int scl)

Private Attributes

double _factor
short ** _I
bool _initial
short ** _J
int _nChans
unsigned int _Time
double _vol
bool interpFilt
bool largeFilter
bool linearInterp

Static Private Attributes

static short LARGE_FILTER_IMP []
static short SMALL_FILTER_IMP []

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index