diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index a2f1dc963..14e14daf6 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,32 @@ 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() ); + } + + // nudge loop point with end + if( m_loopPointModel.value() > m_endPointModel.value() ) + { + m_loopPointModel.setValue( m_endPointModel.value() ); + } + + pointChanged(); + +} + +void audioFileProcessor::endPointChanged( void ) +{ + // same as start, for now + 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 +404,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 +430,8 @@ void audioFileProcessor::loopPointChanged( void ) + + QPixmap * AudioFileProcessorView::s_artwork = NULL; @@ -449,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. " diff --git a/plugins/audio_file_processor/audio_file_processor.h b/plugins/audio_file_processor/audio_file_processor.h index 5531bb890..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();