Back to C-ASPT Contents Page
asptSoiir232f
API Summary
API to create and delete an asptSoiir232f filters
API to filter through and update an asptSoiir232f filters
API to retrieve the properties of an asptSoiir232f objects
- DT32S soiir232fGetDelayLine (asptSoiir232f *soiir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- soiir232fGetCfCoef( asptSoiir232f
*soiir )
- soiir232fGetBwCoef( asptSoiir232f
*soiir )
- soiir232fGetDelayLinePtr( asptSoiir232f
*soiir )
- soiir232fGetLastErrorSample( asptSoiir232f
*soiir )
- soiir232fGetCfStepSize( asptSoiir232f
*soiir )
- soiir232fGetBwStepSize( asptSoiir232f
*soiir )
- soiir232fGetCfMin( asptSoiir232f
*soiir )
- soiir232fGetBwMin( asptSoiir232f
*soiir )
- soiir232fGetCfMax( asptSoiir232f
*soiir )
- soiir232fGetBwMax( asptSoiir232f
*soiir )
API to set the properties of an asptSoiir232f filter
- DT32S soiir232fReset(asptSoiir232f *soiir)
- DT32S soiir232fResetDelayLine(asptSoiir232f *soiir)
- DT32S soiir232fSetDelayLine (asptSoiir232f *soiir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- soiir232fSetCfCoef( asptSoiir232f
*soiir, ncf )
- soiir232fSetBwCoef( asptSoiir232f
*soiir, nbw )
- soiir232fSetCfStepSize( asptSoiir232f
*soiir, ss )
- soiir232fSetBwStepSize( asptSoiir232f
*soiir, ss )
- soiir232fSetCfMin( asptSoiir232f
*soiir, cfmin )
- soiir232fSetBwMin( asptSoiir232f
*soiir, bwmin )
- soiir232fSetCfMax( asptSoiir232f
*soiir, cfmax )
- soiir232fSetBwMax( asptSoiir232f
*soiir, bwmax )
Description
Implements the Second Order IIR type-2 adaptive algorithm.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
soiir232fInit
DT32S soiir232fInit(asptSoiir232f *soiir, DT32F cf, DT32F bw, DT32F cfss, DT32F cfbw)
Initializes an asptSoiir232f filter. No memory allocation is needed.- Returns :
- Input Parameters :
- soiir : pointer to asptSoiir232f filter to be initialized
- cf : initial value of center frequency coefficient [0 PI]
- bw : initial value of bandwidth coef [0 1]
- cfss : center frequency step size
- bwss : bandwidth step size
- Remarks :
-
bwMax = 0.9f; bwMin = 0.1f; cfMax = 3.12f; cfMin = 0.05f; all delay lines are reset to zeros use the soiir232fSetxxx to change the default values if necessary.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_RANGE_ERR : cf/bw is not a valid input value
<< Back to top
soiir232fFilterUpdate
DT32F soiir232fFilterUpdate(asptSoiir232f *soiir, DT32F x)
Calculates the filter output and updates the cf and bw coefficients according to the soiir2 algorithm. - Returns :
- Input Parameters :
- soiir2 : pointer to the asptSoiir232f filter
- x : new input sample
- Remarks :
-
The last error sample is stored internally and can be retrieved by calling soiir232fGetLastErrorSample().
<< Back to top
soiir232fFilterOnly
DT32F soiir232fFilterOnly (asptSoiir232f *soiir, DT32F x)
Calculates the filter output but does not update the coefficients. It also updates the internal delay lines. - Returns :
- Input Parameters :
- soiir2 : pointer to the asptSoiir232f filter
- x : input sample vector
- Remarks :
-
The last error sample is stored internally and can be retrieved by calling soiir232fGetLastErrorSample().
<< Back to top
soiir232fReset
DT32S soiir232fReset(asptSoiir232f *soiir)
Resets all filter coefficients to zero- Returns :
- Input Parameters :
- soiir : pointer to an asptSoiir232f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
soiir232fResetDelayLine
DT32S soiir232fResetDelayLine(asptSoiir232f *soiir)
Resets all internal delay lines to zero.- Returns :
- Input Parameters :
- soiir : pointer to an asptSoiir232f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
soiir232fSetDelayLine
DT32S soiir232fSetDelayLine (asptSoiir232f *soiir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Initializes the N; 0<= N <=2 internal delay line samples starting from delayLine[ind] sample. to the contents of the given array. ind = 0 is the newest input sample. - Returns :
-
On success returns the number of samples initialized, otherwise an error code (negative int).
- Input Parameters :
- soiir : pointer to an asptSoiir232f filter to be set.
- newBuf : pointer to the new samples vector.
- ind : index to the first sample to be set.
- N : number of samples to be set
- flip : if not 0, will flip the samples order.
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/soiir is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
- Remarks :
-
Samples assumed to be stored in newBuf with newest sample at index 0, and oldest at index N-1, when flip == 0.
<< Back to top
soiir232fGetDelayLine
DT32S soiir232fGetDelayLine (asptSoiir232f *soiir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies the N; 0 <= N <=2 internal delay line samples starting from delayLine[ind] to the given buffer; ind = 0 is the newest input sample. - Returns :
-
On success returns the number of samples copied, otherwise the error code (negative int).
- Input Parameters :
- soiir : pointer to an asptSoiir232f filter to be set
- dstBuf : pointer to the destination buffer
- ind : index to the first sample to be copied
- N : number of samples to be copied
- flip : if not 0, will flip the samples order.
- Output Parameters :
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/soiir is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
- Remarks :
-
Samples are stored in dstBuf with newest sample at index 0, and oldest at index N-1, when flip == 0.