Merge pull request #758 from grejppi/master-samplebuffer
SampleBuffer: fix amplification
This commit is contained in:
@@ -272,8 +272,7 @@ void SampleBuffer::convertIntToFloat ( int_sample_t * & _ibuf, f_cnt_t _frames,
|
||||
{
|
||||
// following code transforms int-samples into
|
||||
// float-samples and does amplifying & reversing
|
||||
const float fac = m_amplification /
|
||||
OUTPUT_SAMPLE_MULTIPLIER;
|
||||
const float fac = 1 / OUTPUT_SAMPLE_MULTIPLIER;
|
||||
m_data = new sampleFrame[_frames];
|
||||
const int ch = ( _channels > 1 ) ? 1 : 0;
|
||||
|
||||
@@ -758,6 +757,12 @@ bool SampleBuffer::play( sampleFrame * _ab, handleState * _state,
|
||||
_state->setBackwards( is_backwards );
|
||||
_state->setFrameIndex( play_frame );
|
||||
|
||||
for( fpp_t i = 0; i < _frames; ++i )
|
||||
{
|
||||
_ab[i][0] *= m_amplification;
|
||||
_ab[i][1] *= m_amplification;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -929,9 +934,9 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr,
|
||||
for( int frame = first; frame < last; frame += fpp )
|
||||
{
|
||||
l[n] = QPoint( xb + ( (frame - first) * double( w ) / nb_frames ),
|
||||
(int)( yb - ( m_data[frame][0] * y_space ) ) );
|
||||
(int)( yb - ( m_data[frame][0] * y_space * m_amplification ) ) );
|
||||
r[n] = QPoint( xb + ( (frame - first) * double( w ) / nb_frames ),
|
||||
(int)( yb - ( m_data[frame][1] * y_space ) ) );
|
||||
(int)( yb - ( m_data[frame][1] * y_space * m_amplification ) ) );
|
||||
++n;
|
||||
}
|
||||
_p.drawPolyline( l, nb_frames / fpp );
|
||||
|
||||
Reference in New Issue
Block a user