From 43865ad28330db6472f25d9e1568c231df0aa938 Mon Sep 17 00:00:00 2001 From: Dave French Date: Thu, 9 Apr 2015 00:00:09 +0100 Subject: [PATCH 1/2] AFP update parameters of wave display when loading sample This is changing from opening a new wave display with each sample. This fixes an issue where the play position cursor was not being drawn. --- .../audio_file_processor.cpp | 21 ++++++++++++------- .../audio_file_processor.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index be7519179..f402c513e 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -716,7 +716,7 @@ void AudioFileProcessorView::paintEvent( QPaintEvent * ) void AudioFileProcessorView::sampleUpdated( void ) { - newWaveView(); + m_waveView->updateFromTo(); m_waveView->update(); update(); } @@ -733,7 +733,7 @@ void AudioFileProcessorView::openAudioFile( void ) { castModel()->setAudioFile( af ); Engine::getSong()->setModified(); - newWaveView(); + m_waveView->updateFromTo(); } } @@ -759,6 +759,16 @@ void AudioFileProcessorView::modelChanged( void ) +void AudioFileProcessorWaveView::updateFromTo() +{ + if( m_sampleBuffer.frames() > 1 ) + { + const f_cnt_t marging = ( m_sampleBuffer.endFrame() - m_sampleBuffer.startFrame() ) * 0.1; + m_from = qMax( 0, m_sampleBuffer.startFrame() - marging ); + m_to = qMin( m_sampleBuffer.endFrame() + marging, m_sampleBuffer.frames() ); + } +} + AudioFileProcessorWaveView::AudioFileProcessorWaveView( QWidget * _parent, int _w, int _h, SampleBuffer& buf ) : QWidget( _parent ), m_sampleBuffer( buf ), @@ -779,12 +789,7 @@ AudioFileProcessorWaveView::AudioFileProcessorWaveView( QWidget * _parent, int _ setFixedSize( _w, _h ); setMouseTracking( true ); - if( m_sampleBuffer.frames() > 1 ) - { - const f_cnt_t marging = ( m_sampleBuffer.endFrame() - m_sampleBuffer.startFrame() ) * 0.1; - m_from = qMax( 0, m_sampleBuffer.startFrame() - marging ); - m_to = qMin( m_sampleBuffer.endFrame() + marging, m_sampleBuffer.frames() ); - } + updateFromTo(); m_graph.fill( Qt::transparent ); update(); diff --git a/plugins/audio_file_processor/audio_file_processor.h b/plugins/audio_file_processor/audio_file_processor.h index 2e7a2b3a5..428917fb3 100644 --- a/plugins/audio_file_processor/audio_file_processor.h +++ b/plugins/audio_file_processor/audio_file_processor.h @@ -261,6 +261,7 @@ public: void setKnobs(knob *_start, knob *_end, knob *_loop ); + void updateFromTo(); private: void zoom( const bool _out = false ); void slide( int _px ); From bd5dfddfd4f8b201cd78cda610863b47cbd714dc Mon Sep 17 00:00:00 2001 From: Dave French Date: Thu, 9 Apr 2015 02:13:31 +0100 Subject: [PATCH 2/2] AFP renamed updateFromTo() to updateSampleRange() --- plugins/audio_file_processor/audio_file_processor.cpp | 8 ++++---- plugins/audio_file_processor/audio_file_processor.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index f402c513e..7225a28de 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -716,7 +716,7 @@ void AudioFileProcessorView::paintEvent( QPaintEvent * ) void AudioFileProcessorView::sampleUpdated( void ) { - m_waveView->updateFromTo(); + m_waveView->updateSampleRange(); m_waveView->update(); update(); } @@ -733,7 +733,7 @@ void AudioFileProcessorView::openAudioFile( void ) { castModel()->setAudioFile( af ); Engine::getSong()->setModified(); - m_waveView->updateFromTo(); + m_waveView->updateSampleRange(); } } @@ -759,7 +759,7 @@ void AudioFileProcessorView::modelChanged( void ) -void AudioFileProcessorWaveView::updateFromTo() +void AudioFileProcessorWaveView::updateSampleRange() { if( m_sampleBuffer.frames() > 1 ) { @@ -789,7 +789,7 @@ AudioFileProcessorWaveView::AudioFileProcessorWaveView( QWidget * _parent, int _ setFixedSize( _w, _h ); setMouseTracking( true ); - updateFromTo(); + updateSampleRange(); m_graph.fill( Qt::transparent ); update(); diff --git a/plugins/audio_file_processor/audio_file_processor.h b/plugins/audio_file_processor/audio_file_processor.h index 428917fb3..988cc5382 100644 --- a/plugins/audio_file_processor/audio_file_processor.h +++ b/plugins/audio_file_processor/audio_file_processor.h @@ -261,7 +261,7 @@ public: void setKnobs(knob *_start, knob *_end, knob *_loop ); - void updateFromTo(); + void updateSampleRange(); private: void zoom( const bool _out = false ); void slide( int _px );