106 QPainter painter(
this );
107 painter.setRenderHint( QPainter::Antialiasing );
109 bool issmaller =
false;
111 painter.drawPixmap( ev->rect(),
m_background, ev->rect() );
112 painter.setPen( QColor( 230, 230, 230 ) );
113 int VCenterl = height() / 4;
114 int VCenterr = height() / 4 + height() / 2;
118 for (
int x = 25; x < width() -25; x++ ) {
124 painter.drawLine( x, 0 +VCenterl, x, 0 +VCenterl );
125 painter.drawLine( x, 0 +VCenterr, x, 0 +VCenterr );
131 painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
133 painter.setPen( QPen( QColor( 255, 255, 255 ), 1, Qt::DotLine ) );
134 painter.drawLine( 23, 4, 23, height() -4 );
135 painter.drawLine( width() -23, 4,width() -23, height() -4 );
136 painter.setPen( QPen( QColor( 255, 255, 255 ), 1, Qt::SolidLine ) );
138 painter.drawLine( 0, VCenterl, width(),VCenterl );
139 painter.drawLine( 0, VCenterr, width(),VCenterr );
143 QColor startColor = QColor( 32, 173, 0, 200 );
144 QColor endColor = QColor( 217, 68, 0, 200 );
145 QColor loopColor = QColor( 93, 170, 254, 200 );
146 font.setWeight( QFont::Bold );
147 painter.setFont( font );
180 int nSampleLength = pNewSample->get_frames();
182 float nScaleFactor = nSampleLength / (width() -50);
183 if ( nScaleFactor < 1 ){
187 float fGain = height() / 4.0 * 1.0;
189 auto pSampleDatal = pNewSample->get_data_l();
190 auto pSampleDatar = pNewSample->get_data_r();
192 unsigned nSamplePos = 0;
197 for (
int i = 0; i < width(); ++i ){
198 for (
int j = 0; j < nScaleFactor; ++j ) {
199 if ( j < nSampleLength && nSamplePos < nSampleLength) {
200 if ( pSampleDatal[ nSamplePos ] && pSampleDatar[ nSamplePos ] ){
201 newVall =
static_cast<int>( pSampleDatal[ nSamplePos ] * fGain );
202 newValr =
static_cast<int>( pSampleDatar[ nSamplePos ] * fGain );
static void set_paint_color(QPainter &painter, const QColor &color, bool selected, MainSampleWaveDisplay::Slider which)
virtual void mouseMoveEvent(QMouseEvent *ev) override
MainSampleWaveDisplay(QWidget *pParent)
void updateDisplayPointer()
void updateDisplay(const QString &filename)
virtual void mousePressEvent(QMouseEvent *ev) override
int m_nStartFramePosition
void chooseSlider(QMouseEvent *ev)
virtual void mouseReleaseEvent(QMouseEvent *ev) override
bool m_bLoopSliderIsMoved
void testPosition(QMouseEvent *ev)
void paintLocatorEvent(int pos, bool last_event)
bool m_bStartSliderIsMoved
virtual void paintEvent(QPaintEvent *ev) override