Browse Source

cmDspKr.c : Added bypass to echo cancel.

master
kevin 9 years ago
parent
commit
47db49bb43
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      dsp/cmDspKr.c

+ 10
- 3
dsp/cmDspKr.c View File

3752
   kMuEcId,
3752
   kMuEcId,
3753
   kImpRespN_EcId,
3753
   kImpRespN_EcId,
3754
   kDelayN_EcId,
3754
   kDelayN_EcId,
3755
+  kBypassEcId,
3755
   kUnfiltInEcId,
3756
   kUnfiltInEcId,
3756
   kFiltInEcId,
3757
   kFiltInEcId,
3757
   kOutEcId
3758
   kOutEcId
3781
     1,   "mu",     kMuEcId,        0,0, kInDsvFl   | kDoubleDsvFl,   "NLSM mu coefficient.",
3782
     1,   "mu",     kMuEcId,        0,0, kInDsvFl   | kDoubleDsvFl,   "NLSM mu coefficient.",
3782
     1,   "irN",    kImpRespN_EcId, 0,0, kInDsvFl   | kUIntDsvFl,     "Filter impulse response length in samples.",
3783
     1,   "irN",    kImpRespN_EcId, 0,0, kInDsvFl   | kUIntDsvFl,     "Filter impulse response length in samples.",
3783
     1,   "delayN", kDelayN_EcId,   0,0, kInDsvFl   | kUIntDsvFl,     "Fixed feedback delay in samples.",
3784
     1,   "delayN", kDelayN_EcId,   0,0, kInDsvFl   | kUIntDsvFl,     "Fixed feedback delay in samples.",
3785
+    1,   "bypass", kBypassEcId,    0,0, kInDsvFl   | kBoolDsvFl,     "Bypass enable flag.",
3784
     1,   "uf_in",  kUnfiltInEcId,  0,1, kInDsvFl   | kAudioBufDsvFl, "Unfiltered audio input",
3786
     1,   "uf_in",  kUnfiltInEcId,  0,1, kInDsvFl   | kAudioBufDsvFl, "Unfiltered audio input",
3785
     1,   "f_in",   kFiltInEcId,    0,1, kInDsvFl   | kAudioBufDsvFl, "Filtered audio input",
3787
     1,   "f_in",   kFiltInEcId,    0,1, kInDsvFl   | kAudioBufDsvFl, "Filtered audio input",
3786
     1,   "out",    kOutEcId,       0,1, kOutDsvFl  | kAudioBufDsvFl, "Audio output",
3788
     1,   "out",    kOutEcId,       0,1, kOutDsvFl  | kAudioBufDsvFl, "Audio output",
3791
   
3793
   
3792
   cmDspSetDefaultDouble( ctx, &p->inst, kMuEcId,        0, 0.1);
3794
   cmDspSetDefaultDouble( ctx, &p->inst, kMuEcId,        0, 0.1);
3793
   cmDspSetDefaultUInt(   ctx, &p->inst, kImpRespN_EcId, 0, 2048);
3795
   cmDspSetDefaultUInt(   ctx, &p->inst, kImpRespN_EcId, 0, 2048);
3794
-  cmDspSetDefaultUInt(   ctx, &p->inst, kDelayN_EcId,   0, 1906);
3796
+  cmDspSetDefaultUInt(   ctx, &p->inst, kDelayN_EcId,   0, 1765);
3797
+  cmDspSetDefaultBool(   ctx, &p->inst, kBypassEcId,    0, false);
3795
 
3798
 
3796
   return &p->inst;
3799
   return &p->inst;
3797
 }
3800
 }
3835
 {
3838
 {
3836
   cmDspRC_t          rc       = kOkDspRC;
3839
   cmDspRC_t          rc       = kOkDspRC;
3837
   cmDspEchoCancel_t* p        = (cmDspEchoCancel_t*)inst;
3840
   cmDspEchoCancel_t* p        = (cmDspEchoCancel_t*)inst;
3838
-  bool               bypassFl = false;
3841
+  bool               bypassFl = true; //cmDspBool(inst,kBypassEcId);
3839
   
3842
   
3840
   const cmSample_t*   fV = cmDspAudioBuf(ctx,inst,kFiltInEcId,0);
3843
   const cmSample_t*   fV = cmDspAudioBuf(ctx,inst,kFiltInEcId,0);
3841
   unsigned            fN = cmDspAudioBufSmpCount(ctx,inst,kFiltInEcId,0);
3844
   unsigned            fN = cmDspAudioBufSmpCount(ctx,inst,kFiltInEcId,0);
3850
   
3853
   
3851
   if( bypassFl )
3854
   if( bypassFl )
3852
   {
3855
   {
3853
-    cmVOS_Copy(yV,yN,fV);
3856
+    cmVOS_Copy(yV,yN,uV);
3854
   }
3857
   }
3855
   else
3858
   else
3856
   {
3859
   {
3885
       case kDelayN_EcId:
3888
       case kDelayN_EcId:
3886
         cmNlmsEcSetDelayN( p->r, cmDspUInt(inst,kDelayN_EcId));
3889
         cmNlmsEcSetDelayN( p->r, cmDspUInt(inst,kDelayN_EcId));
3887
         break;
3890
         break;
3891
+
3892
+      case kBypassEcId:
3893
+        printf("EC bypass:%i\n",cmDspBool(inst,kBypassEcId));
3894
+        break;
3888
     }
3895
     }
3889
   }
3896
   }
3890
 
3897
 

Loading…
Cancel
Save