| 1028 | |
| 1029 | |
| 1030 | void AudioFileProcessorWaveView::updateGraph() |
| 1031 | { |
| 1032 | if( m_to == 1 ) |
| 1033 | { |
| 1034 | m_to = m_sampleBuffer.frames() * 0.7; |
| 1035 | slideSamplePointToFrames( end, m_to * 0.7 ); |
| 1036 | } |
| 1037 | |
| 1038 | if( m_from > m_sampleBuffer.startFrame() ) |
| 1039 | { |
| 1040 | m_from = m_sampleBuffer.startFrame(); |
| 1041 | } |
| 1042 | |
| 1043 | if( m_to < m_sampleBuffer.endFrame() ) |
| 1044 | { |
| 1045 | m_to = m_sampleBuffer.endFrame(); |
| 1046 | } |
| 1047 | |
| 1048 | if( m_sampleBuffer.reversed() != m_reversed ) |
| 1049 | { |
| 1050 | reverse(); |
| 1051 | } |
| 1052 | else if( m_last_from == m_from && m_last_to == m_to && m_sampleBuffer.amplification() == m_last_amp ) |
| 1053 | { |
| 1054 | return; |
| 1055 | } |
| 1056 | |
| 1057 | m_last_from = m_from; |
| 1058 | m_last_to = m_to; |
| 1059 | m_last_amp = m_sampleBuffer.amplification(); |
| 1060 | |
| 1061 | m_graph.fill( Qt::transparent ); |
| 1062 | QPainter p( &m_graph ); |
| 1063 | p.setPen( QColor( 255, 255, 255 ) ); |
| 1064 | |
| 1065 | m_sampleBuffer.visualize( |
| 1066 | p, |
| 1067 | QRect( 0, 0, m_graph.width(), m_graph.height() ), |
| 1068 | m_from, m_to |
| 1069 | ); |
| 1070 | } |
| 1071 | |
| 1072 | |
| 1073 | |