104 QPainter painter(
this );
105 painter.setRenderHint( QPainter::Antialiasing );
107 bool issmaller =
false;
109 painter.drawPixmap( ev->rect(),
m_background, ev->rect() );
110 painter.setPen( QColor( 230, 230, 230 ) );
111 int VCenterl = height() / 4;
112 int VCenterr = height() / 4 + height() / 2;
116 for (
int x = 25; x < width() -25; x++ ) {
122 painter.drawLine( x, 0 +VCenterl, x, 0 +VCenterl );
123 painter.drawLine( x, 0 +VCenterr, x, 0 +VCenterr );
129 painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
131 painter.setPen( QPen( QColor( 255, 255, 255 ), 1, Qt::DotLine ) );
132 painter.drawLine( 23, 4, 23, height() -4 );
133 painter.drawLine( width() -23, 4,width() -23, height() -4 );
134 painter.setPen( QPen( QColor( 255, 255, 255 ), 1, Qt::SolidLine ) );
136 painter.drawLine( 0, VCenterl, width(),VCenterl );
137 painter.drawLine( 0, VCenterr, width(),VCenterr );
141 QColor startColor = QColor( 32, 173, 0, 200 );
142 QColor endColor = QColor( 217, 68, 0, 200 );
143 QColor loopColor = QColor( 93, 170, 254, 200 );
144 font.setWeight( 63 );
145 painter.setFont( font );
178 int nSampleLength = pNewSample->get_frames();
180 float nScaleFactor = nSampleLength / (width() -50);
181 if ( nScaleFactor < 1 ){
185 float fGain = height() / 4.0 * 1.0;
187 auto pSampleDatal = pNewSample->get_data_l();
188 auto pSampleDatar = pNewSample->get_data_r();
190 unsigned nSamplePos = 0;
195 for (
int i = 0; i < width(); ++i ){
196 for (
int j = 0; j < nScaleFactor; ++j ) {
197 if ( j < nSampleLength && nSamplePos < nSampleLength) {
198 if ( pSampleDatal[ nSamplePos ] && pSampleDatar[ nSamplePos ] ){
199 newVall =
static_cast<int>( pSampleDatal[ nSamplePos ] * fGain );
200 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