From b1a108abd376805a1472ee6ee5b5977200ec6052 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 27 Aug 2015 17:49:24 -0400 Subject: [PATCH] cmProc5.h : Added cmVectArray's uVa and fVa. --- cmProc5.c | 21 +++++++++++++++++++-- cmProc5.h | 9 +++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/cmProc5.c b/cmProc5.c index eabdd35..1cfc16d 100644 --- a/cmProc5.c +++ b/cmProc5.c @@ -918,8 +918,11 @@ cmNlmsEc_t* cmNlmsEcAlloc( cmCtx* ctx, cmNlmsEc_t* ap, float mu, unsigned hN, un { cmNlmsEc_t* p = cmObjAlloc(cmNlmsEc_t,ctx,ap); - // allocate the vect array + // allocate the vect array's + p->uVa = cmVectArrayAlloc(ctx, kFloatVaFl ); + p->fVa = cmVectArrayAlloc(ctx, kFloatVaFl ); p->eVa = cmVectArrayAlloc(ctx, kFloatVaFl ); + if( mu != 0 ) if( cmNlmsEcInit(p,mu,hN,delayN) != cmOkRC ) @@ -1024,13 +1027,27 @@ cmRC_t cmNlmsEcExec( cmNlmsEc_t* p, const cmSample_t* xV, const cmSample_t* } + cmVectArrayAppendS(p->uVa,xV,xyN); + cmVectArrayAppendS(p->fVa,fV,xyN); + cmVectArrayAppendS(p->eVa,yV,xyN); + + return cmOkRC; } cmRC_t cmNlmsEcWrite( cmNlmsEc_t* p, const cmChar_t* dirStr ) { + + if( p->uVa != NULL ) + cmVectArrayWriteDirFn(p->uVa, dirStr, "nlms_unfiltered.va"); + + if( p->fVa != NULL ) + cmVectArrayWriteDirFn(p->fVa, dirStr, "nlms_filtered.va"); + if( p->eVa != NULL ) - cmVectArrayWriteDirFn(p->eVa,dirStr, "nlms_err.va"); + cmVectArrayWriteDirFn(p->eVa, dirStr, "nlms_out.va"); + + return cmOkRC; } diff --git a/cmProc5.h b/cmProc5.h index 050a07d..ad8a7b6 100644 --- a/cmProc5.h +++ b/cmProc5.h @@ -235,10 +235,11 @@ extern "C" { unsigned hN; // filter length unsigned delayN; // fixed delay to apply to align xV with fV. double* wV; // wV[hN] filter weights - double* hV; // hV[hN] filter delay line - - unsigned w0i; - + double* hV; // hV[hN] filter delay line + unsigned w0i; // The index into hV[] of the start of the delay line. + + cmVectArray_t* uVa; + cmVectArray_t* fVa; cmVectArray_t* eVa; } cmNlmsEc_t;