| 414 | |
| 415 | |
| 416 | void EnvelopeAndLfoView::paintEvent( QPaintEvent * ) |
| 417 | { |
| 418 | QPainter p( this ); |
| 419 | p.setRenderHint( QPainter::Antialiasing ); |
| 420 | |
| 421 | // draw envelope-graph |
| 422 | p.drawPixmap( ENV_GRAPH_X, ENV_GRAPH_Y, *s_envGraph ); |
| 423 | // draw LFO-graph |
| 424 | p.drawPixmap( LFO_GRAPH_X, LFO_GRAPH_Y, *s_lfoGraph ); |
| 425 | |
| 426 | |
| 427 | p.setFont( pointSize<8>( p.font() ) ); |
| 428 | |
| 429 | const float gray_amount = 1.0f - fabsf( m_amountKnob->value<float>() ); |
| 430 | |
| 431 | p.setPen( QPen( QColor( static_cast<int>( 96 * gray_amount ), |
| 432 | static_cast<int>( 255 - 159 * gray_amount ), |
| 433 | static_cast<int>( 128 - 32 * gray_amount ) ), |
| 434 | 2 ) ); |
| 435 | |
| 436 | const QColor end_points_color( 0x99, 0xAF, 0xFF ); |
| 437 | const QColor end_points_bg_color( 0, 0, 2 ); |
| 438 | |
| 439 | const int y_base = ENV_GRAPH_Y + s_envGraph->height() - 3; |
| 440 | const int avail_height = s_envGraph->height() - 6; |
| 441 | |
| 442 | int x1 = static_cast<int>( m_predelayKnob->value<float>() * TIME_UNIT_WIDTH ); |
| 443 | int x2 = x1 + static_cast<int>( m_attackKnob->value<float>() * TIME_UNIT_WIDTH ); |
| 444 | int x3 = x2 + static_cast<int>( m_holdKnob->value<float>() * TIME_UNIT_WIDTH ); |
| 445 | int x4 = x3 + static_cast<int>( ( m_decayKnob->value<float>() * |
| 446 | ( 1 - m_sustainKnob->value<float>() ) ) * TIME_UNIT_WIDTH ); |
| 447 | int x5 = x4 + static_cast<int>( m_releaseKnob->value<float>() * TIME_UNIT_WIDTH ); |
| 448 | |
| 449 | if( x5 > 174 ) |
| 450 | { |
| 451 | x1 = ( x1 * 174 ) / x5; |
| 452 | x2 = ( x2 * 174 ) / x5; |
| 453 | x3 = ( x3 * 174 ) / x5; |
| 454 | x4 = ( x4 * 174 ) / x5; |
| 455 | x5 = ( x5 * 174 ) / x5; |
| 456 | } |
| 457 | x1 += ENV_GRAPH_X + 2; |
| 458 | x2 += ENV_GRAPH_X + 2; |
| 459 | x3 += ENV_GRAPH_X + 2; |
| 460 | x4 += ENV_GRAPH_X + 2; |
| 461 | x5 += ENV_GRAPH_X + 2; |
| 462 | |
| 463 | p.drawLine( x1, y_base, x2, y_base - avail_height ); |
| 464 | p.fillRect( x1 - 1, y_base - 2, 4, 4, end_points_bg_color ); |
| 465 | p.fillRect( x1, y_base - 1, 2, 2, end_points_color ); |
| 466 | |
| 467 | p.drawLine( x2, y_base - avail_height, x3, y_base - avail_height ); |
| 468 | p.fillRect( x2 - 1, y_base - 2 - avail_height, 4, 4, |
| 469 | end_points_bg_color ); |
| 470 | p.fillRect( x2, y_base - 1 - avail_height, 2, 2, end_points_color ); |
| 471 | |
| 472 | p.drawLine( x3, y_base-avail_height, x4, static_cast<int>( y_base - |
| 473 | avail_height + |
nothing calls this directly
no test coverage detected