Back to C-ASPT Contents Page
asptMcfxlms32f
API Summary
API to create and delete an asptMcfxlms32f filters
- DT32S mcfxlms32fInit (asptMcfxlms32f *mcfxlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S chL, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL)
- DT32S mcfxlms32fInitStatic(asptMcfxlms32f *mcfxlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S chL, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL, DT32F *pCof, DT32F *pDat)
- void mcfxlms32fFree(asptMcfxlms32f *mcfxlms)
API to filter through and update an asptMcfxlms32f filters
API to retrieve the properties of an asptMcfxlms32f filter
- DT32S mcfxlms32fGetCoef(asptMcfxlms32f *mcfxlms, DT32F *buf, DT32S ref, DT32S act, DT32S ind, DT32S N, DT32S flip)
- DT32S mcfxlms32fGetDelayLine(asptMcfxlms32f *mcfxlms, DT32F *buf, DT32S ref, DT32S ind, DT32S N, DT32S flip)
- mcfxlms32fGetCoefPtr( asptMcfxlms32f
*mcfxlms )
- mcfxlms32fGetSecPathPtr( asptMcfxlms32f
*mcfxlms )
- mcfxlms32fGetEstSecPathPtr( asptMcfxlms32f
*mcfxlms )
- mcfxlms32fGetFilterLength( asptMcfxlms32f
*mcfxlms )
- mcfxlms32fGetSecPathLength( asptMcfxlms32f
*mcfxlms )
- mcfxlms32fGetEstSecPathLength( asptMcfxlms32f
*mcfxlms )
- mcfxlms32fGetStepSize( asptMcfxlms32f
*mcfxlms )
- mcfxlms32fGetNrefs( asptMcfxlms32f
*mcfxlms )
- mcfxlms32fGetNacts( asptMcfxlms32f
*mcfxlms )
- mcfxlms32fGetNsens( asptMcfxlms32f
*mcfxlms )
API to set the properties of an asptMcfxlms32f filter
- DT32S mcfxlms32fReset(asptMcfxlms32f *mcfxlms)
- DT32S mcfxlms32fResetDelayLine(asptMcfxlms32f *mcfxlms)
- DT32S mcfxlms32fResize(asptMcfxlms32f *mcfxlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S newLength)
- DT32S mcfxlms32fSetCoef(asptMcfxlms32f *mcfxlms, DT32F *newCoef, DT32S ref, DT32S act, DT32S ind, DT32S N, DT32S flip)
- DT32S mcfxlms32fSetDelayLine(asptMcfxlms32f *mcfxlms, DT32F *newCoef, DT32S ref, DT32S ind, DT32S N, DT32S flip)
- mcfxlms32fSetStepSize( asptMcfxlms32f
*mcfxlms, newStep )
- mcfxlms32fSetSecPathPtr( asptMcfxlms32f
*mcfxlms, newPtr )
- mcfxlms32fSetEstSecPathPtr( asptMcfxlms32f
*mcfxlms, newPtr )
- mcfxlms32fSetSecPathLength( asptMcfxlms32f
*mcfxlms, newLength )
- mcfxlms32fSetEstSecPathLength( asptMcfxlms32f
*mcfxlms, newLength )
Description
Implements the MCFXLMS algorithm. This version is intended for simulation purposes only. For real-time application use asptRtmcfxlms filters instead.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
mcfxlms32fInit
DT32S mcfxlms32fInit (asptMcfxlms32f *mcfxlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S chL, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL)
Initializes an asptMcfxlms32f filter and allocates its necessary storage buffers. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- mcfxlms : asptMcfxlms32f filter to be initialized
- Nref : number of input reference signals
- Nact : number of secondary actuators
- Nsen : number of error sensors
- L : number of filter coefficients for each channel
- mu : step size.
- sPath : pointer to the real secondary path FIR response
- sL : length of the secondary path response sPath
- sPathEst : pointer to the estimated secondary path FIR response
- seL : length of the estimated secondary path response sPathEst
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : sPath/sPathEst is a NULL pointer
- ASPT_RANGE_ERR : Nref/Nact/Nsen/L/sL/seL is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
mcfxlms32fInitStatic
DT32S mcfxlms32fInitStatic(asptMcfxlms32f *mcfxlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S chL, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL, DT32F *pCof, DT32F *pDat)
Initializes an asptMcfxlms32f filter to use pre-allocated memory. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- mcfxlms : asptMcfxlms32f filter to be initialized
- Nref : number of input reference signals
- Nact : number of secondary actuators
- Nsen : number of error sensors
- L : number of filter coefficients
- mu : step size.
- sPath : pointer to the real secondary path FIR response
- sL : length of the secondary path response sPath
- sPathEst : pointer to the estimated secondary path FIR response
- seL : length of the estimated secondary path response sPathEst
- pCof : pointer to a pre-allocated memory block to be used for the
adaptive filter coefficients. At least L*Nref*Nact memory locations must be available starting at this memory address.
- pDat : pointer to a pre-allocated memory block to be used for data
storage. At least [(L+seL)*Nref+(Nact*sL)+(seL*Nsen)+Nact] memory locations must be available starting at this address.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : sPath/sPathEst/pCof/pDat is a NULL pointer
- ASPT_RANGE_ERR : Nref/Nact/Nsen/L/sL/seL is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
mcfxlms32fFilterUpdate
DT32S mcfxlms32fFilterUpdate(asptMcfxlms32f *mcfxlms, DT32F ref[], DT32F prim[], DT32F sen[])
Calculates the filter output and updates the coefficients vector according to the MCFXLMS algorithm. - Returns :
- Input Parameters :
- mcfxlms : pointer to the asptMcfxlms32f filter
- ref : array of new reference samples at each input
- prim : array of primary source samples measured at the sensors
- Output Parameters :
- sens : array of sensor samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfxlms32fFilterOnly
DT32S mcfxlms32fFilterOnly (asptMcfxlms32f *mcfxlms, DT32F ref[], DT32F prim[], DT32F sen[])
Calculates the filter output and updates the internal delay lines but does not updates the coefficients. - Returns :
-
0 on success, otherwise a negative int.
- Input Parameters :
- mcfxlms : pointer to the asptMcfxlms32f filter
- ref : array of new reference samples at each input
- prim : array of primary source samples measured at the sensors
- Output Parameters :
- sens : array of sensor samples.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfxlms32fFree
void mcfxlms32fFree(asptMcfxlms32f *mcfxlms)
Frees the allocated memory for this asptMcfxlms32f filter. - Returns :
- Input Parameters :
- mcfxlms : pointer to the asptMcfxlms32f filter
- Remarks :
-
Use this function only with asptMcfxlms32f filters created with mcfxlms32fInit(). Do not use with filters created using mcfxlms32fInitStatic().
<< Back to top
mcfxlms32fReset
DT32S mcfxlms32fReset(asptMcfxlms32f *mcfxlms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- mcfxlms : pointer to an asptMcfxlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfxlms32fResetDelayLine
DT32S mcfxlms32fResetDelayLine(asptMcfxlms32f *mcfxlms)
Resets all internal delay lines to zero. - Returns :
- Input Parameters :
- mcfxlms : pointer to an asptMcfxlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcfxlms32fGetCoef
DT32S mcfxlms32fGetCoef(asptMcfxlms32f *mcfxlms, DT32F *buf, DT32S ref, DT32S act, DT32S ind, DT32S N, DT32S flip)
Copies the N internal filter coefficients of the transfer function between ref and act starting from coef[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- mcfxlms : pointer to an asptMcfxlms32f filter.
- dstBuf : destination buffer.
- ind : index to the first coefficient to be copied
- ref,act : specify the transfer function to be copied
- N : number of coefficients to be copied.
- flip : if not 0, will flip the coefficients order
- Output Parameters :
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/mcfxlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ref/act/ind/N is not a valid input value
<< Back to top
mcfxlms32fSetCoef
DT32S mcfxlms32fSetCoef(asptMcfxlms32f *mcfxlms, DT32F *newCoef, DT32S ref, DT32S act, DT32S ind, DT32S N, DT32S flip)
Initializes N coefficients of the transfer function between reference ref and actuator act, starting from coef[ind] to the contents of newCoef. - Returns :
-
On success returns the number of coefficients initialized, otherwise the error code (negative int).
- Input Parameters :
- mcfxlms : pointer to an asptMcfxlms32f filter to be set.
- newCoef : new coefficients vector.
- ref, act : specify the filter to be set.
- ind : index to the first coefficient to be set.
- N : number of coefficients to be set.
- flip : if not 0, will copy the coefficients in reverse order
- Output Parameters :
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/mcfxlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ref/act/ind/N is not a valid input value
<< Back to top
mcfxlms32fGetDelayLine
DT32S mcfxlms32fGetDelayLine(asptMcfxlms32f *mcfxlms, DT32F *buf, DT32S ref, DT32S ind, DT32S N, DT32S flip)
Copies N internal delay line samples starting from delayLine[ind] of reference ref to dstBuf. - Returns :
-
On success returns the number of samples copied, otherwise the error code (negative int).
- Input Parameters :
- mcfxlms : pointer to an asptMcfxlms32f filter.
- dstBuf : destination buffer.
- ref : specify the reference signal delay line to be copied
- 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/mcfxlms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ref/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.
<< Back to top
mcfxlms32fSetDelayLine
DT32S mcfxlms32fSetDelayLine(asptMcfxlms32f *mcfxlms, DT32F *newCoef, DT32S ref, DT32S ind, DT32S N, DT32S flip)
Initializes the N internal delay line samples for reference ref, starting from delayLine[ind] to the contents of newBuf. - Returns :
-
On success returns the number of samples initialized, otherwise the error code (negative int).
- Input Parameters :
- mcfxlms : pointer to an asptMcfxlms32f filter.
- newBuf : new data buffer.
- ref : specifies the reference signal delay line to be set.
- ind : index to the first sample to be initialized.
- N : number of samples to be initialized.
- flip : if not 0, will flip the samples order.
- Output Parameters :
- mcfxlms->delayLine is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/mcfxlms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ref/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
mcfxlms32fResize
DT32S mcfxlms32fResize(asptMcfxlms32f *mcfxlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S newLength)
Resizes an asptMcfxlms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- mcfxlms : pointer to the asptMcfxlms32f filter to be resized.
- Nref : Number of reference signals
- Nact : Number of secondary actuators
- Nsen : Number of error sensors
- newLen : required new filter length in each channel
- Error Conditions
- ASPT_NO_ERR : Resizing is success
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : Nref/Nact/Nsen/newLength is not a valid input value
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
- Remarks :
-
Use this function only with dynamically allocated asptMcfxlms32f filters.