cmProc2.c:Fixed bug in cmPvAnlInit() where cmShiftBufExec() was not called inside a while() condition.
This commit is contained in:
parent
b467c7abd4
commit
650b2a95a4
35
cmProc2.c
35
cmProc2.c
@ -2300,11 +2300,10 @@ cmRC_t cmPvAnlInit( cmPvAnl* p, unsigned procSmpCnt, double srate, unsigned
|
|||||||
cmRC_t cmPvAnlFinal(cmPvAnl* p )
|
cmRC_t cmPvAnlFinal(cmPvAnl* p )
|
||||||
{ return cmOkRC; }
|
{ return cmOkRC; }
|
||||||
|
|
||||||
|
|
||||||
bool cmPvAnlExec( cmPvAnl* p, const cmSample_t* x, unsigned xN )
|
bool cmPvAnlExec( cmPvAnl* p, const cmSample_t* x, unsigned xN )
|
||||||
{
|
{
|
||||||
bool fl = false;
|
bool fl = false;
|
||||||
if( cmShiftBufExec(&p->sb,x,xN) )
|
while( cmShiftBufExec(&p->sb,x,xN) )
|
||||||
{
|
{
|
||||||
cmWndFuncExec(&p->wf, p->sb.outV, p->sb.wndSmpCnt );
|
cmWndFuncExec(&p->wf, p->sb.outV, p->sb.wndSmpCnt );
|
||||||
|
|
||||||
@ -2421,13 +2420,12 @@ cmRC_t cmPvSynExec( cmPvSyn* p, const cmReal_t* magV, const cmReal_t* phsV )
|
|||||||
double twoPi = 2.0 * M_PI;
|
double twoPi = 2.0 * M_PI;
|
||||||
unsigned k;
|
unsigned k;
|
||||||
|
|
||||||
|
|
||||||
for(k=0; k<p->binCnt; ++k)
|
for(k=0; k<p->binCnt; ++k)
|
||||||
{
|
{
|
||||||
// phase dist between cur and prv frame
|
// phase dist between cur and prv frame
|
||||||
cmReal_t dp = phsV[k] - p->phs0V[k];
|
cmReal_t dp = phsV[k] - p->phs0V[k];
|
||||||
|
|
||||||
// dist must be positive (cmcum phase always increases)
|
// dist must be positive (accum phase always increases)
|
||||||
if( dp < -0.00001 )
|
if( dp < -0.00001 )
|
||||||
dp += twoPi;
|
dp += twoPi;
|
||||||
|
|
||||||
@ -2450,7 +2448,8 @@ cmRC_t cmPvSynExec( cmPvSyn* p, const cmReal_t* magV, const cmReal_t* phsV )
|
|||||||
p->mag0V[k] = magV[k];
|
p->mag0V[k] = magV[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
cmIFftExecPolarRS( &p->ft, p->magV, p->phsV );
|
cmIFftExecPolarRS( &p->ft, magV, phsV );
|
||||||
|
|
||||||
cmOlaExecS( &p->ola, p->ft.outV, p->ft.outN );
|
cmOlaExecS( &p->ola, p->ft.outV, p->ft.outN );
|
||||||
|
|
||||||
//printf("%i %i\n",p->binCnt,p->ft.binCnt );
|
//printf("%i %i\n",p->binCnt,p->ft.binCnt );
|
||||||
@ -2462,6 +2461,16 @@ cmRC_t cmPvSynExec( cmPvSyn* p, const cmReal_t* magV, const cmReal_t* phsV )
|
|||||||
return cmOkRC;
|
return cmOkRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmRC_t cmPvSynDoIt( cmPvSyn* p, const cmSample_t* v )
|
||||||
|
{
|
||||||
|
cmOlaExecS( &p->ola, v, p->wndSmpCnt );
|
||||||
|
|
||||||
|
//printf("%f\n",cmVOS_RMS(s,p->wndSmpCnt,p->wndSmpCnt));
|
||||||
|
|
||||||
|
return cmOkRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const cmSample_t* cmPvSynExecOut(cmPvSyn* p )
|
const cmSample_t* cmPvSynExecOut(cmPvSyn* p )
|
||||||
{ return cmOlaExecOut(&p->ola); }
|
{ return cmOlaExecOut(&p->ola); }
|
||||||
|
|
||||||
@ -3653,9 +3662,14 @@ cmRC_t cmNmfExec( cmNmf_t* p, const cmReal_t* vM, unsigned cn )
|
|||||||
cmSpecDist_t* cmSpecDistAlloc( cmCtx* ctx,cmSpecDist_t* ap, unsigned procSmpCnt, double srate, unsigned wndSmpCnt, unsigned hopFcmt, unsigned olaWndTypeId )
|
cmSpecDist_t* cmSpecDistAlloc( cmCtx* ctx,cmSpecDist_t* ap, unsigned procSmpCnt, double srate, unsigned wndSmpCnt, unsigned hopFcmt, unsigned olaWndTypeId )
|
||||||
{
|
{
|
||||||
cmSpecDist_t* p = cmObjAlloc( cmSpecDist_t, ctx, ap );
|
cmSpecDist_t* p = cmObjAlloc( cmSpecDist_t, ctx, ap );
|
||||||
|
|
||||||
|
|
||||||
if( procSmpCnt != 0 )
|
if( procSmpCnt != 0 )
|
||||||
|
{
|
||||||
if( cmSpecDistInit( p, procSmpCnt, srate, wndSmpCnt, hopFcmt, olaWndTypeId ) != cmOkRC )
|
if( cmSpecDistInit( p, procSmpCnt, srate, wndSmpCnt, hopFcmt, olaWndTypeId ) != cmOkRC )
|
||||||
cmSpecDistFree(&p);
|
cmSpecDistFree(&p);
|
||||||
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3713,8 +3727,10 @@ cmRC_t cmSpecDistInit( cmSpecDist_t* p, unsigned procSmpCnt, double srate, unsig
|
|||||||
p->aeMin = 1000;
|
p->aeMin = 1000;
|
||||||
p->aeMax = -1000;
|
p->aeMax = -1000;
|
||||||
|
|
||||||
|
|
||||||
//p->bypOut = cmMemResizeZ(cmSample_t, p->bypOut, procSmpCnt );
|
//p->bypOut = cmMemResizeZ(cmSample_t, p->bypOut, procSmpCnt );
|
||||||
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3723,6 +3739,7 @@ cmRC_t cmSpecDistFinal(cmSpecDist_t* p )
|
|||||||
cmRC_t rc = cmOkRC;
|
cmRC_t rc = cmOkRC;
|
||||||
cmPvAnlFree(&p->pva);
|
cmPvAnlFree(&p->pva);
|
||||||
cmPvSynFree(&p->pvs);
|
cmPvSynFree(&p->pvs);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3746,6 +3763,7 @@ void _cmSpecDistBasicMode0(cmSpecDist_t* p, cmReal_t* X1m, unsigned binCnt, cmRe
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _cmSpecDistBasicMode(cmSpecDist_t* p, cmReal_t* X1m, unsigned binCnt, cmReal_t thresh )
|
void _cmSpecDistBasicMode(cmSpecDist_t* p, cmReal_t* X1m, unsigned binCnt, cmReal_t thresh )
|
||||||
@ -3856,7 +3874,6 @@ void _cmSpecDistAmpEnvMode( cmSpecDist_t* p, cmReal_t* X1m )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cmRC_t cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
|
cmRC_t cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -3910,11 +3927,15 @@ cmRC_t cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
|
|||||||
cmPvSynExec(p->pvs, X1m, p->pva->phsV );
|
cmPvSynExec(p->pvs, X1m, p->pva->phsV );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmOkRC;
|
return cmOkRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const cmSample_t* cmSpecDistOut( cmSpecDist_t* p )
|
const cmSample_t* cmSpecDistOut( cmSpecDist_t* p )
|
||||||
{ return cmPvSynExecOut(p->pvs); }
|
{
|
||||||
|
return cmPvSynExecOut(p->pvs);
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user