Back to C-ASPT Contents Page
asptMcadjlms32f
API Summary
API to create and delete an asptMcadjlms32f filters
- DT32S mcadjlms32fInit (asptMcadjlms32f *mcadjlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S chL, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL)
- DT32S mcadjlms32fInitStatic(asptMcadjlms32f *mcadjlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S chL, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL, DT32F *pCof, DT32F *pDat)
- void mcadjlms32fFree(asptMcadjlms32f *mcadjlms)
API to filter through and update an asptMcadjlms32f filters
API to retrieve the properties of an asptMcadjlms32f filter
- DT32S mcadjlms32fGetCoef(asptMcadjlms32f *mcadjlms, DT32F *buf, DT32S ref, DT32S act, DT32S ind, DT32S N, DT32S flip)
- DT32S mcadjlms32fGetDelayLine(asptMcadjlms32f *mcadjlms, DT32F *buf, DT32S ref, DT32S ind, DT32S N, DT32S flip)
- mcadjlms32fGetCoefPtr( asptMcadjlms32f
*mcadjlms )
- mcadjlms32fGetSecPathPtr( asptMcadjlms32f
*mcadjlms )
- mcadjlms32fGetEstSecPathPtr( asptMcadjlms32f
*mcadjlms )
- mcadjlms32fGetFilterLength( asptMcadjlms32f
*mcadjlms )
- mcadjlms32fGetSecPathLength( asptMcadjlms32f
*mcadjlms )
- mcadjlms32fGetEstSecPathLength( asptMcadjlms32f
*mcadjlms )
- mcadjlms32fGetStepSize( asptMcadjlms32f
*mcadjlms )
- mcadjlms32fGetNrefs( asptMcadjlms32f
*mcadjlms )
- mcadjlms32fGetNacts( asptMcadjlms32f
*mcadjlms )
- mcadjlms32fGetNsens( asptMcadjlms32f
*mcadjlms )
API to set the properties of an asptMcadjlms32f filter
- DT32S mcadjlms32fReset(asptMcadjlms32f *mcadjlms)
- DT32S mcadjlms32fResetDelayLine(asptMcadjlms32f *mcadjlms)
- DT32S mcadjlms32fResize(asptMcadjlms32f *mcadjlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S newLength)
- DT32S mcadjlms32fSetCoef(asptMcadjlms32f *mcadjlms, DT32F *newCoef, DT32S ref, DT32S act, DT32S ind, DT32S N, DT32S flip)
- DT32S mcadjlms32fSetDelayLine(asptMcadjlms32f *mcadjlms, DT32F *newCoef, DT32S ref, DT32S ind, DT32S N, DT32S flip)
- mcadjlms32fSetStepSize( asptMcadjlms32f
*mcadjlms, newStep )
- mcadjlms32fSetSecPathPtr( asptMcadjlms32f
*mcadjlms, newPtr )
- mcadjlms32fSetEstSecPathPtr( asptMcadjlms32f
*mcadjlms, newPtr )
- mcadjlms32fSetSecPathLength( asptMcadjlms32f
*mcadjlms, newLength )
- mcadjlms32fSetEstSecPathLength( asptMcadjlms32f
*mcadjlms, newLength )
Description
Implements the MCADJLMS algorithm. This version is intended for simulation purposes and matches the Matlab asptmcmcadjlms and init_mcadjlms functions.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
mcadjlms32fInit
DT32S mcadjlms32fInit (asptMcadjlms32f *mcadjlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S chL, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL)
Initializes an asptMcadjlms32f filter and allocates its necessary storage buffers. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- mcadjlms : asptMcadjlms32f 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
mcadjlms32fInitStatic
DT32S mcadjlms32fInitStatic(asptMcadjlms32f *mcadjlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S chL, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL, DT32F *pCof, DT32F *pDat)
Initializes an asptMcadjlms32f filter to use pre-allocated memory. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- mcadjlms : asptMcadjlms32f 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
mcadjlms32fFilterUpdate
DT32S mcadjlms32fFilterUpdate(asptMcadjlms32f *mcadjlms, DT32F ref[], DT32F prim[], DT32F sen[])
Calculates the filter output and updates the coefficients vector according to the MCADJLMS algorithm. - Returns :
- Input Parameters :
- mcadjlms : pointer to the asptMcadjlms32f 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
mcadjlms32fFilterOnly
DT32S mcadjlms32fFilterOnly (asptMcadjlms32f *mcadjlms, 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 :
- mcadjlms : pointer to the asptMcadjlms32f 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
mcadjlms32fFree
void mcadjlms32fFree(asptMcadjlms32f *mcadjlms)
Frees the allocated memory for this mcadjlms filter. - Returns :
- Input Parameters :
- mcadjlms : pointer to the asptMcadjlms32f filter
- Remarks :
-
Use this function only with asptMcadjlms32f filters created with mcadjlmsInit(). Do not use with filters created using mcadjlms32fInitStatic().
<< Back to top
mcadjlms32fReset
DT32S mcadjlms32fReset(asptMcadjlms32f *mcadjlms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- mcadjlms : pointer to an asptMcadjlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcadjlms32fResetDelayLine
DT32S mcadjlms32fResetDelayLine(asptMcadjlms32f *mcadjlms)
Resets all internal delay lines to zero. - Returns :
- Input Parameters :
- mcadjlms : pointer to an asptMcadjlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mcadjlms32fGetCoef
DT32S mcadjlms32fGetCoef(asptMcadjlms32f *mcadjlms, 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 :
- mcadjlms : pointer to an asptMcadjlms32f 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/mcadjlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ref/act/ind/N is not a valid input value
<< Back to top
mcadjlms32fSetCoef
DT32S mcadjlms32fSetCoef(asptMcadjlms32f *mcadjlms, 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 :
- mcadjlms : pointer to an asptMcadjlms32f 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 :
- mcadjlms->coef is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/mcadjlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ref/act/ind/N is not a valid input value
<< Back to top
mcadjlms32fGetDelayLine
DT32S mcadjlms32fGetDelayLine(asptMcadjlms32f *mcadjlms, 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 :
- mcadjlms : pointer to an asptMcadjlms32f 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/mcadjlms->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
mcadjlms32fSetDelayLine
DT32S mcadjlms32fSetDelayLine(asptMcadjlms32f *mcadjlms, 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 :
- mcadjlms : pointer to an asptMcadjlms32f 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 :
- mcadjlms->delayLine is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/mcadjlms->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
mcadjlms32fResize
DT32S mcadjlms32fResize(asptMcadjlms32f *mcadjlms, DT32S Nref, DT32S Nact, DT32S Nsen, DT32S newLength)
Resizes an asptMcadjlms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- mcadjlms : pointer to the asptMcadjlms32f 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 asptMcadjlms32f filters.