Browse Source

cmApBuf.c: Change to sqrt(sum) to sart(sum/cp->mn) in _cmApMeterValue()

master
kevin 11 years ago
parent
commit
0955f67cb3
1 changed files with 1 additions and 2 deletions
  1. 1
    2
      cmApBuf.c

+ 1
- 2
cmApBuf.c View File

102
   for(i=0; i<cp->mn; ++i)
102
   for(i=0; i<cp->mn; ++i)
103
     sum += cp->m[i];
103
     sum += cp->m[i];
104
 
104
 
105
-  return (cmApSample_t)sqrt(sum);
105
+  return cp->mn==0 ? 0 : (cmApSample_t)sqrt(sum/cp->mn);
106
 }
106
 }
107
 
107
 
108
 void _cmApSine( cmApCh* cp, cmApSample_t* b0, unsigned n0, cmApSample_t* b1, unsigned n1, unsigned stride, float srate )
108
 void _cmApSine( cmApCh* cp, cmApSample_t* b0, unsigned n0, cmApSample_t* b1, unsigned n1, unsigned stride, float srate )
571
 
571
 
572
   for(i=0; i<chCnt; ++i)
572
   for(i=0; i<chCnt; ++i)
573
     meterArray[i] = _cmApMeterValue(iop->chArray + i);        
573
     meterArray[i] = _cmApMeterValue(iop->chArray + i);        
574
-  
575
   return chCnt;
574
   return chCnt;
576
 }
575
 }
577
 
576
 

Loading…
Cancel
Save