From 0955f67cb3b79e79c1ae0dfb2f2598d45cc3ef49 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 8 Apr 2013 23:00:40 -0700 Subject: [PATCH] cmApBuf.c: Change to sqrt(sum) to sart(sum/cp->mn) in _cmApMeterValue() --- cmApBuf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmApBuf.c b/cmApBuf.c index ef3abf2..8262ebb 100644 --- a/cmApBuf.c +++ b/cmApBuf.c @@ -102,7 +102,7 @@ cmApSample_t _cmApMeterValue( const cmApCh* cp ) for(i=0; imn; ++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 ) @@ -571,7 +571,6 @@ unsigned cmApBufGetStatus( unsigned devIdx, unsigned flags, double* meterArray, for(i=0; ichArray + i); - return chCnt; }