86 int selected,
const QColor & lineColor,
const QColor & handleColor,
const QColor & selectedColor)
88 if (envelope.empty()) {
92 for (
int i = 0; i < static_cast<int>(envelope.size()) -1; i++){
93 painter.setPen( QPen(lineColor, 1 , Qt::SolidLine) );
94 painter.drawLine( envelope[i].frame, envelope[i].value, envelope[i + 1].frame, envelope[i +1].value );
95 if ( i == selected ) {
96 painter.setBrush( selectedColor );
98 painter.setBrush( handleColor );
100 painter.drawEllipse ( envelope[i].frame - 6/2, envelope[i].value - 6/2, 6, 6 );
104 if ( 0 == selected ) {
105 painter.setBrush( selectedColor );
107 painter.setBrush( handleColor );
109 painter.drawRect ( envelope[0].frame - 12/2, envelope[0].value - 6/2, 12, 6 );
111 if ( envelope.size() - 1 == selected ) {
112 painter.setBrush( selectedColor );
114 painter.setBrush( handleColor );
116 painter.drawRect ( envelope[envelope.size() -1].frame - 12/2, envelope[envelope.size() -1].value - 6/2, 12, 6 );
121 QPainter painter(
this );
125 painter.setRenderHint( QPainter::Antialiasing );
126 painter.drawPixmap( ev->rect(),
m_Background, ev->rect() );
127 painter.setPen( QColor( 252, 142, 73 ));
129 int VCenter = height() / 2;
130 int LCenter = VCenter -4;
131 int RCenter = VCenter +4;
133 for (
int x = 0; x < width() - 1; x++ ) {
137 painter.setPen( QColor( 116, 186, 255 ));
138 for (
int x = 0; x < width() - 1; x++ ) {
143 Font.setWeight( 63 );
144 painter.setFont( Font );
146 painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
147 painter.setPen( QPen( QColor( 255, 255, 255 ), 1, Qt::SolidLine ) );
150 QColor volumeLineColor = QColor( 255, 255, 255, 200);
151 QColor volumeHandleColor = QColor( 99, 160, 233);
152 QColor panLineColor = QColor( 249, 235, 116, 200 );
153 QColor panHandleColor = QColor( 77, 189, 55 );
154 QColor selectedtHandleColor = QColor( 255, 100, 90 );
158 volumeLineColor, volumeHandleColor, selectedtHandleColor);
161 panLineColor, panHandleColor, selectedtHandleColor);
163 painter.setPen( QPen( QColor( 255, 255, 255 ), 1, Qt::DotLine ) );
164 painter.drawLine( 0, LCenter,
UI_WIDTH, LCenter );
165 painter.setPen( QPen( QColor( 255, 255, 255 ), 1, Qt::DotLine ) );
166 painter.drawLine( 0, RCenter,
UI_WIDTH, RCenter );
170 painter.drawText(
m_nX +5,
m_nY, 60, 20, Qt::AlignLeft, QString(
m_sInfo ) );
174 painter.drawText(
m_nX - 65,
m_nY, 60, 20, Qt::AlignRight, QString(
m_sInfo ) );
180 painter.drawText(
m_nX +5,
m_nY -20, 60, 20, Qt::AlignLeft, QString(
m_sInfo ) );
184 painter.drawText(
m_nX - 65,
m_nY -20, 60, 20, Qt::AlignRight, QString(
m_sInfo ) );
211 if ( pLayer && pLayer->get_sample() ) {
213 int nSampleLength = pLayer->get_sample()->get_frames();
214 float nScaleFactor = nSampleLength / width();
216 float fGain = (height() - 8) / 2.0 * pLayer->get_gain();
218 auto pSampleDatal = pLayer->get_sample()->get_data_l();
219 auto pSampleDatar = pLayer->get_sample()->get_data_r();
223 for (
int i = 0; i < width(); ++i ){
226 for (
int j = 0; j < nScaleFactor; ++j ) {
227 if ( j < nSampleLength ) {
228 if ( pSampleDatal[ nSamplePos ] < 0 ){
229 int newVal =
static_cast<int>( pSampleDatal[ nSamplePos ] * -fGain );
233 int newVal =
static_cast<int>( pSampleDatal[ nSamplePos ] * fGain );
236 if ( pSampleDatar[ nSamplePos ] > 0 ){
237 int newVal =
static_cast<int>( pSampleDatar[ nSamplePos ] * -fGain );
241 int newVal =
static_cast<int>( pSampleDatar[ nSamplePos ] * fGain );
static void paintEnvelope(Sample::VelocityEnvelope &envelope, QPainter &painter, int selected, const QColor &lineColor, const QColor &handleColor, const QColor &selectedColor)