diff --git a/include/SampleBuffer.h b/include/SampleBuffer.h index dd832281b..ef97f84ee 100644 --- a/include/SampleBuffer.h +++ b/include/SampleBuffer.h @@ -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 ); diff --git a/plugins/LadspaEffect/LadspaEffect.cpp b/plugins/LadspaEffect/LadspaEffect.cpp index 891a49438..a2336f519 100644 --- a/plugins/LadspaEffect/LadspaEffect.cpp +++ b/plugins/LadspaEffect/LadspaEffect.cpp @@ -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 ) ) diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index 5d218ab06..d0e0397fc 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -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 )