浏览代码

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

master
kevin 4 年前
父节点
当前提交
af0e716b1f
共有 2 个文件被更改,包括 22 次插入15 次删除
  1. 12
    6
      src/cmProc2.c
  2. 10
    9
      src/cmProc2.h

+ 12
- 6
src/cmProc2.c 查看文件

@@ -6501,7 +6501,8 @@ cmRC_t cmSpecDist2Init( cmSpecDist2_t* p, unsigned procSmpCnt, double srate, uns
6501 6501
   p->wndSmpCnt    = wndSmpCnt;
6502 6502
   p->hopSmpCnt    = (unsigned)floor(wndSmpCnt/hopFcmt);
6503 6503
   p->procSmpCnt   = procSmpCnt;
6504
-
6504
+  p->igain        = 1.0;
6505
+  
6505 6506
   p->ceiling      = 30;
6506 6507
   p->expo         = 2.0;
6507 6508
     
@@ -6511,8 +6512,9 @@ cmRC_t cmSpecDist2Init( cmSpecDist2_t* p, unsigned procSmpCnt, double srate, uns
6511 6512
 
6512 6513
   p->mix          = 0.0;
6513 6514
 
6514
-  p->pva = cmPvAnlAlloc(  p->obj.ctx, NULL, procSmpCnt, srate, wndSmpCnt, p->hopSmpCnt, flags );
6515
-  p->pvs = cmPvSynAlloc(  p->obj.ctx, NULL, procSmpCnt, srate, wndSmpCnt, p->hopSmpCnt, olaWndTypeId );
6515
+  p->igainV = cmMemResizeZ( cmSample_t, p->igainV, procSmpCnt );
6516
+  p->pva    = cmPvAnlAlloc(  p->obj.ctx, NULL, procSmpCnt, srate, wndSmpCnt, p->hopSmpCnt, flags );
6517
+  p->pvs    = cmPvSynAlloc(  p->obj.ctx, NULL, procSmpCnt, srate, wndSmpCnt, p->hopSmpCnt, olaWndTypeId );
6516 6518
 
6517 6519
 
6518 6520
   return rc;
@@ -6522,7 +6524,7 @@ cmRC_t cmSpecDist2Final(cmSpecDist2_t* p )
6522 6524
 {
6523 6525
   cmRC_t rc = cmOkRC;
6524 6526
 
6525
-  
6527
+  cmMemFree(p->igainV);
6526 6528
   cmPvAnlFree(&p->pva);
6527 6529
   cmPvSynFree(&p->pvs);
6528 6530
   return rc;
@@ -6585,8 +6587,12 @@ cmRC_t  cmSpecDist2Exec( cmSpecDist2_t* p, const cmSample_t* sp, unsigned sn )
6585 6587
 
6586 6588
   unsigned binN = p->pva->binCnt;
6587 6589
 
6590
+  cmVOS_MultVVS( p->igainV, sn, sp, p->igain );
6591
+
6592
+  //printf("%f\n",p->igainV[0]);
6593
+
6588 6594
   // cmPvAnlExec() returns true when it calc's a new spectral output frame
6589
-  if( cmPvAnlExec( p->pva, sp, sn ) )
6595
+  if( cmPvAnlExec( p->pva, p->igainV, sn ) )
6590 6596
   {
6591 6597
     cmReal_t X0m[binN];
6592 6598
     cmReal_t X1m[binN]; 
@@ -6652,7 +6658,7 @@ const cmSample_t* cmSpecDist2Out(  cmSpecDist2_t* p )
6652 6658
 
6653 6659
 void  cmSpecDist2Report( cmSpecDist2_t* p )
6654 6660
 {
6655
-  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);
6661
+  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);
6656 6662
 }
6657 6663
 
6658 6664
 

+ 10
- 9
src/cmProc2.h 查看文件

@@ -1318,15 +1318,16 @@ extern "C" {
1318 1318
 
1319 1319
   typedef struct
1320 1320
   {
1321
-    cmObj    obj;
1322
-    double   srate;
1323
-    unsigned wndSmpCnt;
1324
-    unsigned hopFcmt;
1325
-    unsigned hopSmpCnt;
1326
-    unsigned procSmpCnt;
1327
-    
1328
-    cmPvAnl* pva;
1329
-    cmPvSyn* pvs;
1321
+    cmObj       obj;
1322
+    double      srate;
1323
+    unsigned    wndSmpCnt;
1324
+    unsigned    hopFcmt;
1325
+    unsigned    hopSmpCnt;
1326
+    unsigned    procSmpCnt;
1327
+    double      igain;
1328
+    cmSample_t* igainV;
1329
+    cmPvAnl*    pva;
1330
+    cmPvSyn*    pvs;
1330 1331
 
1331 1332
     double   ceiling;
1332 1333
     double   expo;    

正在加载...
取消
保存