Преглед на файлове

cmDspKr.c : Added bypass to echo cancel.

master
kevin преди 9 години
родител
ревизия
47db49bb43
променени са 1 файла, в които са добавени 10 реда и са изтрити 3 реда
  1. 10
    3
      dsp/cmDspKr.c

+ 10
- 3
dsp/cmDspKr.c Целия файл

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

Loading…
Отказ
Запис