diff --git a/include/SampleBuffer.h b/include/SampleBuffer.h index d10e9a2d5..f60518d76 100644 --- a/include/SampleBuffer.h +++ b/include/SampleBuffer.h @@ -42,6 +42,8 @@ class QPainter; +const f_cnt_t MARGIN = 4; + class EXPORT SampleBuffer : public QObject, public sharedObject { Q_OBJECT diff --git a/plugins/audio_file_processor/artwork.png b/plugins/audio_file_processor/artwork.png index 4b0bbe4fb..f1dd96b38 100644 Binary files a/plugins/audio_file_processor/artwork.png and b/plugins/audio_file_processor/artwork.png differ diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index e133a64ef..0a885718f 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -397,7 +397,7 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, m_reverseButton = new pixmapButton( this ); m_reverseButton->setCheckable( TRUE ); - m_reverseButton->move( 200, 124 ); + m_reverseButton->move( 164, 105 ); m_reverseButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "reverse_on" ) ); m_reverseButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -412,7 +412,7 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, pixmapButton * m_loopOffButton = new pixmapButton( this ); m_loopOffButton->setCheckable( TRUE ); - m_loopOffButton->move( 174, 144 ); + m_loopOffButton->move( 190, 105 ); m_loopOffButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "loop_off_on" ) ); m_loopOffButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -425,7 +425,7 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, pixmapButton * m_loopOnButton = new pixmapButton( this ); m_loopOnButton->setCheckable( TRUE ); - m_loopOnButton->move( 200, 144 ); + m_loopOnButton->move( 190, 124 ); m_loopOnButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "loop_on_on" ) ); m_loopOnButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -437,7 +437,7 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, pixmapButton * m_loopPingPongButton = new pixmapButton( this ); m_loopPingPongButton->setCheckable( TRUE ); - m_loopPingPongButton->move( 226, 144 ); + m_loopPingPongButton->move( 216, 124 ); m_loopPingPongButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "loop_pingpong_on" ) ); m_loopPingPongButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -455,7 +455,7 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, m_stutterButton = new pixmapButton( this ); m_stutterButton->setCheckable( true ); - m_stutterButton->move( 226, 124 ); + m_stutterButton->move( 164, 124 ); m_stutterButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "stutter_on" ) ); m_stutterButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( @@ -472,8 +472,7 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, m_ampKnob = new knob( knobBright_26, this ); m_ampKnob->setVolumeKnob( TRUE ); - m_ampKnob->move( 17, 108 ); - m_ampKnob->setFixedSize( 37, 47 ); + m_ampKnob->move( 5, 108 ); m_ampKnob->setHintText( tr( "Amplify:" )+" ", "%" ); m_ampKnob->setWhatsThis( tr( "With this knob you can set the amplify ratio. When you " @@ -482,21 +481,21 @@ AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument, "actual sample-file isn't touched!)" ) ); m_startKnob = new AudioFileProcessorWaveView::knob( this ); - m_startKnob->move( 68, 108 ); + m_startKnob->move( 45, 108 ); m_startKnob->setHintText( tr( "Startpoint:" )+" ", "" ); m_startKnob->setWhatsThis( tr( "With this knob you can set the point where " "AudioFileProcessor should begin playing your sample. " ) ); m_endKnob = new AudioFileProcessorWaveView::knob( this ); - m_endKnob->move( 119, 108 ); + m_endKnob->move( 125, 108 ); m_endKnob->setHintText( tr( "Endpoint:" )+" ", "" ); m_endKnob->setWhatsThis( tr( "With this knob you can set the point where " "AudioFileProcessor should stop playing your sample. " ) ); m_loopKnob = new AudioFileProcessorWaveView::knob( this ); - m_loopKnob->move( 68, 58 ); + m_loopKnob->move( 85, 108 ); m_loopKnob->setHintText( tr( "Loopback point:" )+" ", "" ); m_loopKnob->setWhatsThis( tr( "With this knob you can set the point where " @@ -684,6 +683,7 @@ AudioFileProcessorWaveView::AudioFileProcessorWaveView( QWidget * _parent, int _ m_to = qMin( m_sampleBuffer.endFrame() + marging, m_sampleBuffer.frames() ); } + m_graph.fill( Qt::transparent ); update(); } @@ -968,6 +968,7 @@ void AudioFileProcessorWaveView::updateGraph() m_graph.fill( Qt::transparent ); QPainter p( &m_graph ); p.setPen( QColor( 255, 255, 255 ) ); + m_sampleBuffer.visualize( p, QRect( 0, 0, m_graph.width(), m_graph.height() ), diff --git a/plugins/audio_file_processor/loop_off_off.png b/plugins/audio_file_processor/loop_off_off.png index a66e94d99..645f75e4e 100644 Binary files a/plugins/audio_file_processor/loop_off_off.png and b/plugins/audio_file_processor/loop_off_off.png differ diff --git a/plugins/audio_file_processor/loop_off_on.png b/plugins/audio_file_processor/loop_off_on.png index 4cf0edf2e..210d7bc8f 100644 Binary files a/plugins/audio_file_processor/loop_off_on.png and b/plugins/audio_file_processor/loop_off_on.png differ diff --git a/plugins/audio_file_processor/loop_pingpong_off.png b/plugins/audio_file_processor/loop_pingpong_off.png index 6758d2c79..4308ca380 100644 Binary files a/plugins/audio_file_processor/loop_pingpong_off.png and b/plugins/audio_file_processor/loop_pingpong_off.png differ diff --git a/plugins/audio_file_processor/loop_pingpong_on.png b/plugins/audio_file_processor/loop_pingpong_on.png index f21112c7a..ddd691312 100644 Binary files a/plugins/audio_file_processor/loop_pingpong_on.png and b/plugins/audio_file_processor/loop_pingpong_on.png differ diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index 9540fb29b..99c4d69c4 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -664,8 +664,7 @@ bool SampleBuffer::play( sampleFrame * _ab, handleState * _state, { SRC_DATA src_data; // Generate output - const f_cnt_t margin = 64; - f_cnt_t fragment_size = (f_cnt_t)( _frames * freq_factor ) + margin; + f_cnt_t fragment_size = (f_cnt_t)( _frames * freq_factor ) + MARGIN; src_data.data_in = getSampleFragment( play_frame, fragment_size, _loopmode, &tmp, &is_backwards, loopStartFrame, loopEndFrame, endFrame )[0]; @@ -771,7 +770,6 @@ sampleFrame * SampleBuffer::getSampleFragment( f_cnt_t _index, f_cnt_t _frames, LoopMode _loopmode, sampleFrame * * _tmp, bool * _backwards, f_cnt_t _loopstart, f_cnt_t _loopend, f_cnt_t _end ) const { - if( _loopmode == LoopOff ) { if( _index + _frames <= _end ) @@ -902,6 +900,8 @@ f_cnt_t SampleBuffer::getPingPongIndex( f_cnt_t _index, f_cnt_t _startf, f_cnt_t void SampleBuffer::visualize( QPainter & _p, const QRect & _dr, const QRect & _clip, f_cnt_t _from_frame, f_cnt_t _to_frame ) { + if( m_frames == 0 ) return; + const bool focus_on_range = _to_frame <= m_frames && 0 <= _from_frame && _from_frame < _to_frame; // _p.setClipRect( _clip ); @@ -922,6 +922,7 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr, } const int fpp = tLimit( nb_frames / w, 1, 20 ); QPoint * l = new QPoint[nb_frames / fpp + 1]; + QPoint * r = new QPoint[nb_frames / fpp + 1]; int n = 0; const int xb = _dr.x(); const int first = focus_on_range ? _from_frame : 0; @@ -929,11 +930,13 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr, for( int frame = first; frame < last; frame += fpp ) { l[n] = QPoint( xb + ( (frame - first) * double( w ) / nb_frames ), - (int)( yb - ( ( m_data[frame][0]+m_data[frame][1] ) * - y_space ) ) ); + (int)( yb - ( m_data[frame][0] * y_space ) ) ); + r[n] = QPoint( xb + ( (frame - first) * double( w ) / nb_frames ), + (int)( yb - ( m_data[frame][1] * y_space ) ) ); ++n; } _p.drawPolyline( l, nb_frames / fpp ); + _p.drawPolyline( r, nb_frames / fpp ); delete[] l; } @@ -1442,10 +1445,13 @@ SampleBuffer::handleState::handleState( bool _varying_pitch ) : m_isBackwards( false ) { int error; + if( ( m_resamplingData = src_new(/* ( engine::mixer()->highQuality() == true ) ? SRC_SINC_FASTEST :*/ - SRC_LINEAR, + engine::mixer()->currentQualitySettings(). + libsrcInterpolation(), + /*SRC_LINEAR,*/ DEFAULT_CHANNELS, &error ) ) == NULL ) { printf( "Error: src_new() failed in sample_buffer.cpp!\n" );