File: wind.c1 /* 2 * wind.c 3 * 4 * Code generation for function 'wind' 5 * 6 */ 7 8 /* Include files */ 9 #include "rt_nonfinite.h" 10 #include "wind.h" 11 #include "wind_emxutil.h" 12 #include "wind_data.h" 13 14 /* Variable Definitions */ 15 static emlrtRTEInfo emlrtRTEI = { 1, 26, "wind", 16 "E:\\micro array project\\Microphone Array\\beamform test\\wind.m" }; 17 18 static emlrtDCInfo emlrtDCI = { 9, 11, "wind", 19 "E:\\micro array project\\Microphone Array\\beamform test\\wind.m", 1 }; 20 21 static emlrtDCInfo b_emlrtDCI = { 9, 11, "wind", 22 "E:\\micro array project\\Microphone Array\\beamform test\\wind.m", 4 }; 23 24 static emlrtDCInfo c_emlrtDCI = { 9, 16, "wind", 25 "E:\\micro array project\\Microphone Array\\beamform test\\wind.m", 1 }; 26 27 static emlrtDCInfo d_emlrtDCI = { 9, 16, "wind", 28 "E:\\micro array project\\Microphone Array\\beamform test\\wind.m", 4 }; 29 30 /* Function Definitions */ 31 void wind(const emlrtStack *sp, real_T tWin, real_T fs, real_T nmic, real_T 32 *nWin, real_T *nInc, emxArray_real_T *inx) 33 { 34 real_T y; 35 real_T b_y; 36 int32_T i0; 37 real_T d0; 38 int32_T loop_ub; 39 covrtLogFcn(&emlrtCoverageInstance, 0U, 0); 40 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 0); 41 *nWin = muDoubleScalarRound(tWin * fs); 42 43 /* Audio window size in samples */ 44 y = *nWin / 2.0; 45 if (y < 0.0) { 46 b_y = muDoubleScalarCeil(y); 47 } else { 48 b_y = muDoubleScalarFloor(y); 49 } 50 51 if (covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 0, *nWin / 2.0 != b_y)) { 52 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 1); 53 54 /* Ensure samples are even for overlap and add */ 55 (*nWin)++; 56 } 57 58 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 2); 59 *nInc = muDoubleScalarRound(*nWin / 2.0); 60 61 /* Window increment %50 overlap */ 62 /* hWin=repmat(hWin,1,nmic); % repeat to match number mic */ 63 i0 = inx->size[0] * inx->size[1]; 64 d0 = *nWin; 65 if (!(d0 >= 0.0)) { 66 emlrtNonNegativeCheckR2012b(d0, &b_emlrtDCI, sp); 67 } 68 69 if (d0 != (int32_T)muDoubleScalarFloor(d0)) { 70 emlrtIntegerCheckR2012b(d0, &emlrtDCI, sp); 71 } 72 73 inx->size[0] = (int32_T)d0; 74 if (!(nmic >= 0.0)) { 75 emlrtNonNegativeCheckR2012b(nmic, &d_emlrtDCI, sp); 76 } 77 78 d0 = nmic; 79 if (d0 != (int32_T)muDoubleScalarFloor(d0)) { 80 emlrtIntegerCheckR2012b(d0, &c_emlrtDCI, sp); 81 } 82 83 inx->size[1] = (int32_T)d0; 84 emxEnsureCapacity(sp, (emxArray__common *)inx, i0, (int32_T)sizeof(real_T), 85 &emlrtRTEI); 86 d0 = *nWin; 87 if (!(d0 >= 0.0)) { 88 emlrtNonNegativeCheckR2012b(d0, &b_emlrtDCI, sp); 89 } 90 91 if (d0 != (int32_T)muDoubleScalarFloor(d0)) { 92 emlrtIntegerCheckR2012b(d0, &emlrtDCI, sp); 93 } 94 95 if (!(nmic >= 0.0)) { 96 emlrtNonNegativeCheckR2012b(nmic, &d_emlrtDCI, sp); 97 } 98 99 y = nmic; 100 if (y != (int32_T)muDoubleScalarFloor(y)) { 101 emlrtIntegerCheckR2012b(y, &c_emlrtDCI, sp); 102 } 103 104 loop_ub = (int32_T)d0 * (int32_T)y; 105 for (i0 = 0; i0 < loop_ub; i0++) { 106 inx->data[i0] = 0.0; 107 } 108 109 /* initial window */ 110 } 111 112 /* End of code generation (wind.c) */ 113 |