cmProc2.h/c : Added igain,igainV to cmSpecDist2.

This commit is contained in:
kevin 2020-08-03 12:17:56 -04:00
parent ad0b1ad901
commit af0e716b1f
2 changed files with 22 additions and 15 deletions

View File

@ -6501,7 +6501,8 @@ cmRC_t cmSpecDist2Init( cmSpecDist2_t* p, unsigned procSmpCnt, double srate, uns
p->wndSmpCnt = wndSmpCnt; p->wndSmpCnt = wndSmpCnt;
p->hopSmpCnt = (unsigned)floor(wndSmpCnt/hopFcmt); p->hopSmpCnt = (unsigned)floor(wndSmpCnt/hopFcmt);
p->procSmpCnt = procSmpCnt; p->procSmpCnt = procSmpCnt;
p->igain = 1.0;
p->ceiling = 30; p->ceiling = 30;
p->expo = 2.0; p->expo = 2.0;
@ -6511,8 +6512,9 @@ cmRC_t cmSpecDist2Init( cmSpecDist2_t* p, unsigned procSmpCnt, double srate, uns
p->mix = 0.0; p->mix = 0.0;
p->pva = cmPvAnlAlloc( p->obj.ctx, NULL, procSmpCnt, srate, wndSmpCnt, p->hopSmpCnt, flags ); p->igainV = cmMemResizeZ( cmSample_t, p->igainV, procSmpCnt );
p->pvs = cmPvSynAlloc( p->obj.ctx, NULL, procSmpCnt, srate, wndSmpCnt, p->hopSmpCnt, olaWndTypeId ); p->pva = cmPvAnlAlloc( p->obj.ctx, NULL, procSmpCnt, srate, wndSmpCnt, p->hopSmpCnt, flags );
p->pvs = cmPvSynAlloc( p->obj.ctx, NULL, procSmpCnt, srate, wndSmpCnt, p->hopSmpCnt, olaWndTypeId );
return rc; return rc;
@ -6522,7 +6524,7 @@ cmRC_t cmSpecDist2Final(cmSpecDist2_t* p )
{ {
cmRC_t rc = cmOkRC; cmRC_t rc = cmOkRC;
cmMemFree(p->igainV);
cmPvAnlFree(&p->pva); cmPvAnlFree(&p->pva);
cmPvSynFree(&p->pvs); cmPvSynFree(&p->pvs);
return rc; return rc;
@ -6585,8 +6587,12 @@ cmRC_t cmSpecDist2Exec( cmSpecDist2_t* p, const cmSample_t* sp, unsigned sn )
unsigned binN = p->pva->binCnt; unsigned binN = p->pva->binCnt;
cmVOS_MultVVS( p->igainV, sn, sp, p->igain );
//printf("%f\n",p->igainV[0]);
// cmPvAnlExec() returns true when it calc's a new spectral output frame // cmPvAnlExec() returns true when it calc's a new spectral output frame
if( cmPvAnlExec( p->pva, sp, sn ) ) if( cmPvAnlExec( p->pva, p->igainV, sn ) )
{ {
cmReal_t X0m[binN]; cmReal_t X0m[binN];
cmReal_t X1m[binN]; cmReal_t X1m[binN];
@ -6652,7 +6658,7 @@ const cmSample_t* cmSpecDist2Out( cmSpecDist2_t* p )
void cmSpecDist2Report( cmSpecDist2_t* p ) void cmSpecDist2Report( cmSpecDist2_t* p )
{ {
printf("ceil:%f expo:%f mix:%f thresh:%f upr:%f lwr:%f\n", p->ceiling,p->expo,p->mix,p->thresh,p->lwrSlope,p->uprSlope); printf("igain:%f ceil:%f expo:%f mix:%f thresh:%f upr:%f lwr:%f\n", p->igain, p->ceiling,p->expo,p->mix,p->thresh,p->lwrSlope,p->uprSlope);
} }

View File

@ -1318,15 +1318,16 @@ extern "C" {
typedef struct typedef struct
{ {
cmObj obj; cmObj obj;
double srate; double srate;
unsigned wndSmpCnt; unsigned wndSmpCnt;
unsigned hopFcmt; unsigned hopFcmt;
unsigned hopSmpCnt; unsigned hopSmpCnt;
unsigned procSmpCnt; unsigned procSmpCnt;
double igain;
cmPvAnl* pva; cmSample_t* igainV;
cmPvSyn* pvs; cmPvAnl* pva;
cmPvSyn* pvs;
double ceiling; double ceiling;
double expo; double expo;