Browse Source

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

master
kevin 4 years ago
parent
commit
af0e716b1f
2 changed files with 22 additions and 15 deletions
  1. 12
    6
      src/cmProc2.c
  2. 10
    9
      src/cmProc2.h

+ 12
- 6
src/cmProc2.c View File

6501
   p->wndSmpCnt    = wndSmpCnt;
6501
   p->wndSmpCnt    = wndSmpCnt;
6502
   p->hopSmpCnt    = (unsigned)floor(wndSmpCnt/hopFcmt);
6502
   p->hopSmpCnt    = (unsigned)floor(wndSmpCnt/hopFcmt);
6503
   p->procSmpCnt   = procSmpCnt;
6503
   p->procSmpCnt   = procSmpCnt;
6504
-
6504
+  p->igain        = 1.0;
6505
+  
6505
   p->ceiling      = 30;
6506
   p->ceiling      = 30;
6506
   p->expo         = 2.0;
6507
   p->expo         = 2.0;
6507
     
6508
     
6511
 
6512
 
6512
   p->mix          = 0.0;
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
   return rc;
6520
   return rc;
6522
 {
6524
 {
6523
   cmRC_t rc = cmOkRC;
6525
   cmRC_t rc = cmOkRC;
6524
 
6526
 
6525
-  
6527
+  cmMemFree(p->igainV);
6526
   cmPvAnlFree(&p->pva);
6528
   cmPvAnlFree(&p->pva);
6527
   cmPvSynFree(&p->pvs);
6529
   cmPvSynFree(&p->pvs);
6528
   return rc;
6530
   return rc;
6585
 
6587
 
6586
   unsigned binN = p->pva->binCnt;
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
   // cmPvAnlExec() returns true when it calc's a new spectral output frame
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
     cmReal_t X0m[binN];
6597
     cmReal_t X0m[binN];
6592
     cmReal_t X1m[binN]; 
6598
     cmReal_t X1m[binN]; 
6652
 
6658
 
6653
 void  cmSpecDist2Report( cmSpecDist2_t* p )
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 View File

1318
 
1318
 
1319
   typedef struct
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
     double   ceiling;
1332
     double   ceiling;
1332
     double   expo;    
1333
     double   expo;    

Loading…
Cancel
Save