Browse Source

cmProc5.h/c : Added audion in/out cmVectArray's to cmPhat.

master
kevin 8 years ago
parent
commit
512171ef9a
2 changed files with 31 additions and 17 deletions
  1. 27
    16
      cmProc5.c
  2. 4
    1
      cmProc5.h

+ 27
- 16
cmProc5.c View File

381
   // allocate the FFT object
381
   // allocate the FFT object
382
   cmFftAllocSR(ctx,&p->fft,NULL,fhN,kToPolarFftFl);
382
   cmFftAllocSR(ctx,&p->fft,NULL,fhN,kToPolarFftFl);
383
   cmIFftAllocRS(ctx,&p->ifft,fhN/2 + 1 );
383
   cmIFftAllocRS(ctx,&p->ifft,fhN/2 + 1 );
384
+
385
+  // allocate the vect array
386
+  p->ftVa = cmVectArrayAlloc(ctx, kSampleVaFl );
384
   
387
   
385
   if( chN != 0 )  
388
   if( chN != 0 )  
386
     if( cmPhatInit(p,chN,hN,alpha,mult,flags) != cmOkRC )
389
     if( cmPhatInit(p,chN,hN,alpha,mult,flags) != cmOkRC )
456
   p->mhM = cmMemResizeZ(float,        p->mhM, p->binN * chN);
459
   p->mhM = cmMemResizeZ(float,        p->mhM, p->binN * chN);
457
   cmPhatReset(p);
460
   cmPhatReset(p);
458
 
461
 
459
-  //if( cmIsFlag(p->flags,kDebugAtPhatFl)) 
460
-  //  cmVectArrayAlloc(ctx, &p->ftVa,  kSampleVaFl );
461
-  //else
462
-  //  p->ftVa = NULL;
463
-
462
+  if( cmIsFlag(p->flags,kDebugAtPhatFl)) 
463
+    cmVectArrayClear(p->ftVa);
464
+  
464
   return rc;
465
   return rc;
465
 
466
 
466
 }
467
 }
659
   {
660
   {
660
     const char* path = NULL;
661
     const char* path = NULL;
661
 
662
 
662
-    if( p->ftVa != NULL )
663
+    if( cmVectArrayCount(p->ftVa) )
663
       if((rc = cmVectArrayWrite(p->ftVa, path = cmFsMakeFn(path,"cmPhatFT","va",dirStr,NULL) )) != cmOkRC )
664
       if((rc = cmVectArrayWrite(p->ftVa, path = cmFsMakeFn(path,"cmPhatFT","va",dirStr,NULL) )) != cmOkRC )
664
         rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"PHAT debug file write failed.");
665
         rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"PHAT debug file write failed.");
665
     
666
     
693
     goto errLabel;
694
     goto errLabel;
694
   }
695
   }
695
 
696
 
696
-  op->va = cmVectArrayAlloc(ctx,kSampleVaFl);
697
+  op->phVa  = cmVectArrayAlloc(ctx,kSampleVaFl);
698
+  op->xVa   = cmVectArrayAlloc(ctx,kSampleVaFl);
699
+  op->yVa   = cmVectArrayAlloc(ctx,kSampleVaFl);
697
 
700
 
698
   // allocate 'this'
701
   // allocate 'this'
699
   if( gsa != NULL )  
702
   if( gsa != NULL )  
723
   if((rc = cmReflectCalcFinal(p)) != cmOkRC )
726
   if((rc = cmReflectCalcFinal(p)) != cmOkRC )
724
     return rc;
727
     return rc;
725
 
728
 
726
-  cmVectArrayFree(&p->va);
729
+  cmVectArrayFree(&p->phVa);
730
+  cmVectArrayFree(&p->xVa);
731
+  cmVectArrayFree(&p->yVa);
727
   cmGoldSigFree(&p->gs); 
732
   cmGoldSigFree(&p->gs); 
728
   cmPhatFree(&p->phat);
733
   cmPhatFree(&p->phat);
729
   
734
   
803
       // execute the correlation
808
       // execute the correlation
804
       cmPhatChExec(p->phat,0,0,0);
809
       cmPhatChExec(p->phat,0,0,0);
805
 
810
 
806
-      // p->phat->xV now holds the correlation result
811
+      // p->phat->xV[fhN] now holds the correlation result
807
       
812
       
808
-      if( p->va != NULL )
809
-        cmVectArrayAppendS(p->va,p->phat->xV,p->phat->fhN );
813
+      if( p->phVa != NULL )
814
+        cmVectArrayAppendS(p->phVa,p->phat->xV,p->phat->fhN );
810
     }
815
     }
811
     
816
     
812
   }
817
   }
813
 
818
 
819
+  cmVectArrayAppendS(p->xVa,xV,xyN);
820
+  cmVectArrayAppendS(p->yVa,yV,xyN);
821
+
814
   return cmOkRC;
822
   return cmOkRC;
815
   
823
   
816
 }
824
 }
819
 {
827
 {
820
   cmRC_t rc = cmOkRC;
828
   cmRC_t rc = cmOkRC;
821
   
829
   
822
-  if( p->va != NULL) 
830
+  if( p->phVa != NULL) 
823
   {
831
   {
824
-    const char* path = NULL;
832
+    //const char* path = NULL;
825
 
833
 
826
-    if((rc = cmVectArrayWrite(p->va, path = cmFsMakeFn(path,"reflect_calc","va",dirStr,NULL) )) != cmOkRC )
827
-        rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Reflect calc file write failed.");
834
+    cmVectArrayWriteDirFn(p->xVa, dirStr, "reflect_calc_x.va" );
835
+    cmVectArrayWriteDirFn(p->yVa, dirStr, "reflect_calc_y.va" );
836
+    cmVectArrayWriteDirFn(p->phVa,dirStr, "reflect_calc_ph.va");
828
     
837
     
829
-    cmFsFreeFn(path);
838
+    //if((rc = cmVectArrayWrite(p->phVa, path = cmFsMakeFn(path,"reflect_calc","va",dirStr,NULL) )) != cmOkRC )
839
+    //    rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Reflect calc file write failed.");    
840
+    //cmFsFreeFn(path);
830
   }
841
   }
831
   
842
   
832
   return rc;
843
   return rc;

+ 4
- 1
cmProc5.h View File

204
     unsigned         xi;  // index into gs->ch[0].mdV[] of the next sample to output
204
     unsigned         xi;  // index into gs->ch[0].mdV[] of the next sample to output
205
     bool             zeroFl;
205
     bool             zeroFl;
206
     cmPhat_t*        phat;
206
     cmPhat_t*        phat;
207
-    cmVectArray_t*   va;
207
+    
208
+    cmVectArray_t*   phVa;
209
+    cmVectArray_t*   xVa;
210
+    cmVectArray_t*   yVa;
208
   } cmReflectCalc_t;
211
   } cmReflectCalc_t;
209
 
212
 
210
   
213
   

Loading…
Cancel
Save