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

This commit is contained in:
kevin 2013-04-08 23:00:40 -07:00
parent 7ce3d9b72a
commit 0955f67cb3

View File

@ -102,7 +102,7 @@ cmApSample_t _cmApMeterValue( const cmApCh* cp )
for(i=0; i<cp->mn; ++i) for(i=0; i<cp->mn; ++i)
sum += cp->m[i]; sum += cp->m[i];
return (cmApSample_t)sqrt(sum); return cp->mn==0 ? 0 : (cmApSample_t)sqrt(sum/cp->mn);
} }
void _cmApSine( cmApCh* cp, cmApSample_t* b0, unsigned n0, cmApSample_t* b1, unsigned n1, unsigned stride, float srate ) void _cmApSine( cmApCh* cp, cmApSample_t* b0, unsigned n0, cmApSample_t* b1, unsigned n1, unsigned stride, float srate )
@ -571,7 +571,6 @@ unsigned cmApBufGetStatus( unsigned devIdx, unsigned flags, double* meterArray,
for(i=0; i<chCnt; ++i) for(i=0; i<chCnt; ++i)
meterArray[i] = _cmApMeterValue(iop->chArray + i); meterArray[i] = _cmApMeterValue(iop->chArray + i);
return chCnt; return chCnt;
} }