From 76a1b8c2b6cd8359b6b79d860627e5a6d3dbf861 Mon Sep 17 00:00:00 2001 From: Dave French Date: Tue, 23 Dec 2014 16:29:04 +0000 Subject: [PATCH 1/2] Proposed fix for 929 AFP wave display --- .../audio_file_processor.cpp | 22 +++++++++++++++++++ .../audio_file_processor.h | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 5b5f1d4e1..a67b91ce7 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -630,6 +630,25 @@ void AudioFileProcessorView::dragEnterEvent( QDragEnterEvent * _dee ) +void AudioFileProcessorView::newWaveView() +{ + if ( m_waveView ) + { + delete m_waveView; + m_waveView = 0; + } + m_waveView = new AudioFileProcessorWaveView( this, 245, 75, castModel()->m_sampleBuffer ); + m_waveView->move( 2, 172 ); + m_waveView->setKnobs( + dynamic_cast( m_startKnob ), + dynamic_cast( m_endKnob ), + dynamic_cast( m_loopKnob ) ); + m_waveView->show(); +} + + + + void AudioFileProcessorView::dropEvent( QDropEvent * _de ) { QString type = stringPairDrag::decodeKey( _de ); @@ -638,6 +657,7 @@ void AudioFileProcessorView::dropEvent( QDropEvent * _de ) { castModel()->setAudioFile( value ); _de->accept(); + newWaveView(); return; } else if( type == QString( "tco_%1" ).arg( track::SampleTrack ) ) @@ -691,6 +711,7 @@ void AudioFileProcessorView::paintEvent( QPaintEvent * ) void AudioFileProcessorView::sampleUpdated( void ) { + newWaveView(); m_waveView->update(); update(); } @@ -707,6 +728,7 @@ void AudioFileProcessorView::openAudioFile( void ) { castModel()->setAudioFile( af ); engine::getSong()->setModified(); + newWaveView(); } } diff --git a/plugins/audio_file_processor/audio_file_processor.h b/plugins/audio_file_processor/audio_file_processor.h index aed376101..6ec9bc032 100644 --- a/plugins/audio_file_processor/audio_file_processor.h +++ b/plugins/audio_file_processor/audio_file_processor.h @@ -118,7 +118,7 @@ public: AudioFileProcessorView( Instrument * _instrument, QWidget * _parent ); virtual ~AudioFileProcessorView(); - + void newWaveView(); protected slots: void sampleUpdated(); void openAudioFile(); From b5538c7da818cbcdde5ff1c885ce4eee5b626f3b Mon Sep 17 00:00:00 2001 From: Dave French Date: Tue, 23 Dec 2014 22:26:36 +0000 Subject: [PATCH 2/2] used newWaveView in constructor, to remove redundancy --- plugins/audio_file_processor/audio_file_processor.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index a67b91ce7..74a9354a5 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -575,13 +575,8 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, m_interpBox->setFont( pointSize<8>( m_interpBox->font() ) ); // wavegraph - m_waveView = new AudioFileProcessorWaveView( this, 245, 75, castModel()->m_sampleBuffer ); - m_waveView->move( 2, 172 ); - m_waveView->setKnobs( - dynamic_cast( m_startKnob ), - dynamic_cast( m_endKnob ), - dynamic_cast( m_loopKnob ) - ); + m_waveView = 0; + newWaveView(); connect( castModel(), SIGNAL( isPlaying( f_cnt_t ) ), m_waveView, SLOT( isPlaying( f_cnt_t ) ) );