From dc681604e04fc85163847e08af11b4a65d13233a Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Sun, 7 Sep 2014 16:02:52 -0400 Subject: [PATCH 1/3] Make start/end/loop knobs all responsive --- .../audio_file_processor.cpp | 44 +++++++++++++++---- .../audio_file_processor.h | 4 ++ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 726665811..e3331f128 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -88,9 +88,9 @@ audioFileProcessor::audioFileProcessor( InstrumentTrack * _instrument_track ) : connect( &m_ampModel, SIGNAL( dataChanged() ), this, SLOT( ampModelChanged() ) ); connect( &m_startPointModel, SIGNAL( dataChanged() ), - this, SLOT( loopPointChanged() ) ); + this, SLOT( startPointChanged() ) ); connect( &m_endPointModel, SIGNAL( dataChanged() ), - this, SLOT( loopPointChanged() ) ); + this, SLOT( endPointChanged() ) ); connect( &m_loopPointModel, SIGNAL( dataChanged() ), this, SLOT( loopPointChanged() ) ); connect( &m_stutterModel, SIGNAL( dataChanged() ), @@ -102,7 +102,7 @@ audioFileProcessor::audioFileProcessor( InstrumentTrack * _instrument_track ) : m_interpolationModel.addItem( tr( "Sinc" ) ); m_interpolationModel.setValue( 1 ); - loopPointChanged(); + pointChanged(); } @@ -266,7 +266,7 @@ void audioFileProcessor::loadSettings( const QDomElement & _this ) m_interpolationModel.setValue( 1 ); //linear by default } - loopPointChanged(); + pointChanged(); } @@ -352,9 +352,7 @@ void audioFileProcessor::stutterModelChanged() } - - -void audioFileProcessor::loopPointChanged( void ) +void audioFileProcessor::startPointChanged( void ) { // check if start is over end and swap values if so if( m_startPointModel.value() > m_endPointModel.value() ) @@ -370,6 +368,26 @@ void audioFileProcessor::loopPointChanged( void ) m_endPointModel.setValue( qMin( m_endPointModel.value() + 0.001f, 1.0f ) ); } + // nudge loop point with start + if( m_loopPointModel.value() < m_startPointModel.value() ) + { + m_loopPointModel.setValue( m_startPointModel.value() ); + } + + pointChanged(); + +} + +void audioFileProcessor::endPointChanged( void ) +{ + // same as start + startPointChanged(); + +} + +void audioFileProcessor::loopPointChanged( void ) +{ + // check that loop point is between start-end points and not overlapping with endpoint // ...and move start/end points ahead if loop point is moved over them if( m_loopPointModel.value() >= m_endPointModel.value() ) @@ -380,11 +398,18 @@ void audioFileProcessor::loopPointChanged( void ) m_loopPointModel.setValue( 1.0f - 0.001f ); } } + + // nudge start point with loop if( m_loopPointModel.value() < m_startPointModel.value() ) { m_startPointModel.setValue( m_loopPointModel.value() ); } + pointChanged(); +} + +void audioFileProcessor::pointChanged( void ) +{ const f_cnt_t f_start = static_cast( m_startPointModel.value() * ( m_sampleBuffer.frames()-1 ) ); const f_cnt_t f_end = static_cast( m_endPointModel.value() * ( m_sampleBuffer.frames()-1 ) ); const f_cnt_t f_loop = static_cast( m_loopPointModel.value() * ( m_sampleBuffer.frames()-1 ) ); @@ -399,6 +424,8 @@ void audioFileProcessor::loopPointChanged( void ) + + QPixmap * AudioFileProcessorView::s_artwork = NULL; @@ -999,13 +1026,14 @@ void AudioFileProcessorWaveView::updateGraph() { reverse(); } - else if( m_last_from == m_from && m_last_to == m_to ) + else if( m_last_from == m_from && m_last_to == m_to && m_sampleBuffer.amplification() == m_last_amp ) { return; } m_last_from = m_from; m_last_to = m_to; + m_last_amp = m_sampleBuffer.amplification(); m_graph.fill( Qt::transparent ); QPainter p( &m_graph ); diff --git a/plugins/audio_file_processor/audio_file_processor.h b/plugins/audio_file_processor/audio_file_processor.h index a29ac51a0..f5d397fbb 100644 --- a/plugins/audio_file_processor/audio_file_processor.h +++ b/plugins/audio_file_processor/audio_file_processor.h @@ -75,6 +75,9 @@ private slots: void reverseModelChanged(); void ampModelChanged(); void loopPointChanged(); + void startPointChanged(); + void endPointChanged(); + void pointChanged(); void stutterModelChanged(); @@ -239,6 +242,7 @@ private: f_cnt_t m_to; f_cnt_t m_last_from; f_cnt_t m_last_to; + float m_last_amp; knob * m_startKnob; knob * m_endKnob; knob * m_loopKnob; From b33eceda7e553e541c8f5a6a199b6903c80879ec Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Sun, 7 Sep 2014 16:20:17 -0400 Subject: [PATCH 2/3] Make loop end move with sample end --- plugins/audio_file_processor/audio_file_processor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index e3331f128..f7b131b9e 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -373,6 +373,12 @@ void audioFileProcessor::startPointChanged( void ) { m_loopPointModel.setValue( m_startPointModel.value() ); } + + // nudge loop point with end + if( m_loopPointModel.value() > m_endPointModel.value() ) + { + m_loopPointModel.setValue( m_endPointModel.value() ); + } pointChanged(); @@ -380,7 +386,7 @@ void audioFileProcessor::startPointChanged( void ) void audioFileProcessor::endPointChanged( void ) { - // same as start + // same as start, for now startPointChanged(); } From 2ca84c15a17faa71a300bfa4de2fdffadf9627aa Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Sun, 7 Sep 2014 16:30:53 -0400 Subject: [PATCH 3/3] Invert loop button pixmaps --- plugins/audio_file_processor/audio_file_processor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index f7b131b9e..14e14daf6 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -482,9 +482,9 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, m_loopOffButton->setCheckable( TRUE ); m_loopOffButton->move( 190, 105 ); m_loopOffButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( - "loop_off_on" ) ); - m_loopOffButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "loop_off_off" ) ); + m_loopOffButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( + "loop_off_on" ) ); toolTip::add( m_loopOffButton, tr( "Disable loop" ) ); m_loopOffButton->setWhatsThis( tr( "This button disables looping. "