Mixer: optimize peak value measuring functions

This commit is contained in:
Vesa
2014-07-14 21:49:34 +03:00
parent 8a35a57efa
commit 5ed8f70633

View File

@@ -518,14 +518,7 @@ float Mixer::peakValueLeft( sampleFrame * _ab, const f_cnt_t _frames )
float p = 0.0f;
for( f_cnt_t f = 0; f < _frames; ++f )
{
if( _ab[f][0] > p )
{
p = _ab[f][0];
}
else if( -_ab[f][0] > p )
{
p = -_ab[f][0];
}
p = qMax( p, qAbs( _ab[f][0] ) );
}
return p;
}
@@ -538,14 +531,7 @@ float Mixer::peakValueRight( sampleFrame * _ab, const f_cnt_t _frames )
float p = 0.0f;
for( f_cnt_t f = 0; f < _frames; ++f )
{
if( _ab[f][1] > p )
{
p = _ab[f][1];
}
else if( -_ab[f][1] > p )
{
p = -_ab[f][1];
}
p = qMax( p, qAbs( _ab[f][1] ) );
}
return p;
}