Various fixes and precautions

Samplebuffer: reload all samples when samplerate changes. This is because of the way LMMS uses samples: we always resample all samples t$
LadspaEffect: some safeguards for the non-inplacebroken plugins which use the same buffer for input and output. Theoretically, if some p$
FxMixer: fix effect processing in multichannel-chains
This commit is contained in:
Vesa
2014-10-12 00:59:50 +03:00
parent 9fe55161a8
commit dc4bfdc60d
3 changed files with 12 additions and 3 deletions

View File

@@ -267,7 +267,7 @@ public slots:
void setEndFrame( const f_cnt_t _e );
void setAmplification( float _a );
void setReversed( bool _on );
void sampleRateChanged();
private:
void update( bool _keep_settings = false );

View File

@@ -307,6 +307,8 @@ void LadspaEffect::pluginInstantiation()
int inputch = 0;
int outputch = 0;
LADSPA_Data * inbuf [2];
inbuf[0] = NULL;
inbuf[1] = NULL;
for( ch_cnt_t proc = 0; proc < processorCount(); proc++ )
{
multi_proc_t ports;
@@ -335,7 +337,7 @@ void LadspaEffect::pluginInstantiation()
manager->isPortOutput( m_key, port ) )
{
p->rate = CHANNEL_OUT;
if( ! m_inPlaceBroken )
if( ! m_inPlaceBroken && inbuf[ outputch ] )
{
p->buffer = inbuf[ outputch ];
outputch++;
@@ -343,6 +345,7 @@ void LadspaEffect::pluginInstantiation()
else
{
p->buffer = MM_ALLOC( LADSPA_Data, engine::mixer()->framesPerPeriod() );
m_inPlaceBroken = true;
}
}
else if( manager->isPortInput( m_key, port ) )

View File

@@ -84,6 +84,7 @@ SampleBuffer::SampleBuffer( const QString & _audio_file,
{
loadFromBase64( _audio_file );
}
connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
update();
}
@@ -111,6 +112,7 @@ SampleBuffer::SampleBuffer( const sampleFrame * _data, const f_cnt_t _frames ) :
memcpy( m_origData, _data, _frames * BYTES_PER_FRAME );
m_origFrames = _frames;
}
connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
update();
}
@@ -138,6 +140,7 @@ SampleBuffer::SampleBuffer( const f_cnt_t _frames ) :
memset( m_origData, 0, _frames * BYTES_PER_FRAME );
m_origFrames = _frames;
}
connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
update();
}
@@ -152,7 +155,10 @@ SampleBuffer::~SampleBuffer()
void SampleBuffer::sampleRateChanged()
{
update();
}
void SampleBuffer::update( bool _keep_settings )