AFP: add updated artwork, fix the bug where opening the plugin w/o samplebuffer glitches the wavegraph

Samplebuffer: use qualitysettings for interpolation (currently defaults to SINC_FASTEST on playback), also: in visualize, draw both channels instead of averaging them into one graph (otherwise, samplebuffers with counter-phase content show up as flatline)
This commit is contained in:
Vesa
2014-04-10 00:25:25 +03:00
parent d6445b34b3
commit 2599370d53
8 changed files with 25 additions and 16 deletions

View File

@@ -42,6 +42,8 @@
class QPainter;
const f_cnt_t MARGIN = 4;
class EXPORT SampleBuffer : public QObject, public sharedObject
{
Q_OBJECT

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 KiB

After

Width:  |  Height:  |  Size: 245 KiB

View File

@@ -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() ),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 B

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -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<int>( 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" );