cmProc5.h/c : Updated cmGoldSig to use LPF instead of BPF.

This commit is contained in:
kevin 2015-08-07 18:32:04 -04:00
parent 28d2de022a
commit a7f82c0ffe
2 changed files with 28 additions and 3 deletions

View File

@ -209,6 +209,8 @@ void _cmGoldSigModulate( cmGoldSig_t* p, unsigned chIdx )
cmGoldSig_t* cmGoldSigAlloc( cmCtx* ctx, cmGoldSig_t* p, const cmGoldSigArg_t* a )
{
cmGoldSig_t* op = cmObjAlloc(cmGoldSig_t,ctx,p);
p->fir = cmFIRAllocKaiser(ctx, NULL, 0, 0, 0, 0, 0, 0, 0 );
if( a != NULL )
if( cmGoldSigInit(op,a) != cmOkRC )
@ -236,7 +238,8 @@ cmRC_t cmGoldSigFree( cmGoldSig_t** pp )
cmMemFree(p->ch[i].bbV);
cmMemFree(p->ch[i].mdV);
}
cmFIRFree(&p->fir);
cmMemFree(p->ch);
cmMemFree(p->rcosV);
cmMemFree(p->pnM);
@ -270,6 +273,27 @@ cmRC_t cmGoldSigInit( cmGoldSig_t* p, const cmGoldSigArg_t* a )
// generate the rcos impulse response
_cmGoldSigRaisedCos(p->rcosV,p->rcosN,a->samplesPerChip,a->rcosBeta);
if(1)
{
double passHz = 20000.0;
double stopHz = 17000.0;
double passDb = 1.0;
double stopDb = 90.0;
unsigned flags = 0;
if( cmFIRInitKaiser(p->fir, 64, a->srate, passHz, stopHz, passDb, stopDb, flags ) != cmOkRC )
{
rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Unable to allocate internal FIR.");
goto errLabel;
}
p->rcosN = p->fir->coeffCnt;
p->rcosV = cmMemResizeZ(cmSample_t,p->rcosV,p->rcosN);
cmVOS_CopyD(p->rcosV,p->rcosN,p->fir->coeffV);
}
// for each channel
for(i=0; i<a->chN; ++i)
{
@ -294,7 +318,7 @@ cmRC_t cmGoldSigInit( cmGoldSig_t* p, const cmGoldSigArg_t* a )
}
cmRC_t cmGoldSigFinal( cmGoldSig_t* p )
{ return cmOkRC; }
{ return cmFIRFinal(p->fir); }
cmRC_t cmGoldSigWrite( cmCtx* ctx, cmGoldSig_t* p, const char* fn )
{

View File

@ -73,7 +73,8 @@ extern "C" {
cmSample_t* rcosV; // rcosV[rcosN] raised cosine impulse response
unsigned rcosN; // length of raised cosine impulse response
unsigned mlsN; // length of Gold codes (Maximum length sequence length)
unsigned sigN; // length of channel signals bbV[] and mdV[]
unsigned sigN; // length of channel signals bbV[] and mdV[]
cmFIR* fir;
} cmGoldSig_t;