void WaveWidget::updateWave()
{
int h = height();
int w = width();
// I need width and height here.
// Also, I clear the cache at resize events
p.
setRenderHint( QPainter::Antialiasing );
p.fillRect( temp.rect(), Qt::white );
QPen pen
( Qt
::blue,
1 );
// blue solid line, 1 pixels wide p.setPen( pen );
short* audio = reinterpret_cast<short*>(soundStream);
for( unsigned int i = 0; i < numSamples; i++ )// numSamples very big (~10e6 or more)
{
int startY = maxHeight;
for( int k = 0; k < channels; k++ )
{
short* value1 = audio + k;
int x = i / ( numSamples / w);
int y = *value1 * maxHeight / 0x0000FFFF * 2;
QLine line
( x, startY, x, startY
+ y
);
p.drawLine(line);
startY += increment;
}
audio += sampleSize;
}
m_waveCachePixmap = temp;
}