65 QPainter painter(
this );
66 painter.setRenderHint( QPainter::Antialiasing );
67 painter.drawPixmap( ev->rect(),
m_Background, ev->rect() );
69 painter.setPen( QColor( 102, 150, 205 ) );
70 int VCenter = height() / 2;
71 for (
int x = 0; x < width(); x++ ) {
72 painter.drawLine( x, VCenter, x,
m_pPeakData[x] + VCenter );
73 painter.drawLine( x, VCenter, x, -
m_pPeakData[x] + VCenter );
78 painter.setFont( font );
79 painter.setPen( QColor( 255 , 255, 255, 200 ) );
80 painter.drawText( 0, 0, width(), 20, Qt::AlignCenter,
m_sSampleName );
90 if ( pNewSample !=
nullptr ) {
92 QString sName = filename;
93 int nPos = sName.lastIndexOf(
"/" );
95 if ( sName.endsWith(
"emptySample.wav")){
104 int nSampleLength = pNewSample->get_frames();
105 float nScaleFactor = nSampleLength / width();
107 float fGain = height() / 2.0 * 1.0;
109 auto pSampleData = pNewSample->get_data_l();
113 for (
int i = 0; i < width(); ++i ){
115 for (
int j = 0; j < nScaleFactor; ++j ) {
116 if ( j < nSampleLength ) {
117 int newVal =
static_cast<int>( pSampleData[ nSamplePos ] * fGain );
118 if ( newVal > nVal ) {