* LADSPA-effect: added "Notch Filter" to blacklist
* all effect-plugins: replaced old code with effect::checkGate() call, various cleanups and minor optimizations * effectChain: added debugging-code for determining buggy effect-plugins at higher samplerates * plugin: introduced changable publicName-property * effect: added checkGate()-function for reducing redundant code in effect-plugins git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@981 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
24
ChangeLog
24
ChangeLog
@@ -1,3 +1,27 @@
|
||||
2008-05-18 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* plugins/ladspa_effect/ladspa_effect.cpp:
|
||||
added "Notch Filter" to blacklist
|
||||
|
||||
* plugins/ladspa_effect/ladspa_effect.h:
|
||||
* plugins/ladspa_effect/ladspa_effect.cpp:
|
||||
* plugins/bass_booster/bass_booster.cpp:
|
||||
* plugins/stereo_matrix/stereo_matrix.cpp:
|
||||
* plugins/stereo_enhancer/stereo_enhancer.cpp:
|
||||
- replaced old code with effect::checkGate() call
|
||||
- various cleanups and minor optimizations
|
||||
|
||||
* src/core/effect_chain.cpp:
|
||||
added debugging-code for determining buggy effect-plugins at higher
|
||||
samplerates
|
||||
|
||||
* include/plugin.h:
|
||||
introduced changable publicName-property
|
||||
|
||||
* include/effect.h:
|
||||
* src/core/effect.cpp:
|
||||
added checkGate()-function for reducing redundant code in effect-plugins
|
||||
|
||||
2008-05-17 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* plugins/ladspa_effect/ladspa_effect.cpp:
|
||||
|
||||
@@ -171,6 +171,8 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
void checkGate( double _out_sum );
|
||||
|
||||
virtual pluginView * instantiateView( QWidget * );
|
||||
|
||||
// some effects might not be capable of higher sample-rates so they can
|
||||
|
||||
@@ -169,7 +169,13 @@ public:
|
||||
// returns public-name out of descriptor
|
||||
virtual inline QString publicName( void ) const
|
||||
{
|
||||
return( m_descriptor->public_name );
|
||||
return( m_publicName != QString::null ?
|
||||
m_publicName : m_descriptor->public_name );
|
||||
}
|
||||
|
||||
virtual void setPublicName( const QString & _public_name )
|
||||
{
|
||||
m_publicName = _public_name;
|
||||
}
|
||||
|
||||
// return plugin-type
|
||||
@@ -228,6 +234,7 @@ protected:
|
||||
|
||||
private:
|
||||
const descriptor * m_descriptor;
|
||||
QString m_publicName;
|
||||
|
||||
// pointer to instantiation-function in plugin
|
||||
typedef plugin * ( * instantiationHook )( model *, void * );
|
||||
|
||||
@@ -85,26 +85,14 @@ bool bassBoosterEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
{
|
||||
sample_t s[2] = { _buf[f][0], _buf[f][1] };
|
||||
m_bbFX.nextSample( s[0], s[1] );
|
||||
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )
|
||||
{
|
||||
_buf[f][ch] = d * _buf[f][ch] + w * s[ch];
|
||||
out_sum += _buf[f][ch]*_buf[f][ch];
|
||||
}
|
||||
|
||||
_buf[f][0] = d * _buf[f][0] + w * s[0];
|
||||
_buf[f][1] = d * _buf[f][1] + w * s[1];
|
||||
|
||||
out_sum += _buf[f][0]*_buf[f][0] + _buf[f][1]*_buf[f][1];
|
||||
}
|
||||
|
||||
if( out_sum / _frames <= getGate()+0.000001 )
|
||||
{
|
||||
incrementBufferCount();
|
||||
if( getBufferCount() > getTimeout() )
|
||||
{
|
||||
stopRunning();
|
||||
resetBufferCount();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resetBufferCount();
|
||||
}
|
||||
checkGate( out_sum / _frames );
|
||||
|
||||
return( isRunning() );
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ ladspaEffect::ladspaEffect( model * _parent,
|
||||
const descriptor::subPluginFeatures::key * _key ) :
|
||||
effect( &ladspaeffect_plugin_descriptor, _parent, _key ),
|
||||
m_controls( NULL ),
|
||||
m_publicName( "none" ),
|
||||
m_maxSampleRate( 0 ),
|
||||
m_key( ladspaSubPluginFeatures::subPluginKeyToLadspaKey( _key ) )
|
||||
{
|
||||
@@ -128,13 +127,12 @@ bool ladspaEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
int frames = _frames;
|
||||
sampleFrame * o_buf = NULL;
|
||||
|
||||
int sr = m_maxSampleRate;
|
||||
if( sr < engine::getMixer()->processingSampleRate() )
|
||||
if( m_maxSampleRate < engine::getMixer()->processingSampleRate() )
|
||||
{
|
||||
o_buf = _buf;
|
||||
_buf = new sampleFrame[_frames];
|
||||
sampleDown( o_buf, _buf, sr );
|
||||
frames = _frames * sr /
|
||||
sampleDown( o_buf, _buf, m_maxSampleRate );
|
||||
frames = _frames * m_maxSampleRate /
|
||||
engine::getMixer()->processingSampleRate();
|
||||
}
|
||||
|
||||
@@ -243,25 +241,12 @@ bool ladspaEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
|
||||
if( o_buf != NULL )
|
||||
{
|
||||
sampleBack( _buf, o_buf, sr );
|
||||
sampleBack( _buf, o_buf, m_maxSampleRate );
|
||||
delete[] _buf;
|
||||
}
|
||||
|
||||
// Check whether we need to continue processing input. Restart the
|
||||
// counter if the threshold has been exceeded.
|
||||
if( out_sum / frames <= getGate()+0.000001 )
|
||||
{
|
||||
incrementBufferCount();
|
||||
if( getBufferCount() > getTimeout() )
|
||||
{
|
||||
stopRunning();
|
||||
resetBufferCount();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resetBufferCount();
|
||||
}
|
||||
checkGate( out_sum / frames );
|
||||
|
||||
|
||||
bool is_running = isRunning();
|
||||
m_pluginMutex.unlock();
|
||||
@@ -543,14 +528,15 @@ void ladspaEffect::pluginDestruction( void )
|
||||
|
||||
|
||||
|
||||
static QMap<QString, int> __buggy_plugins;
|
||||
static QMap<QString, sample_rate_t> __buggy_plugins;
|
||||
|
||||
int ladspaEffect::maxSamplerate( const QString & _name )
|
||||
sample_rate_t ladspaEffect::maxSamplerate( const QString & _name )
|
||||
{
|
||||
if( __buggy_plugins.isEmpty() )
|
||||
{
|
||||
__buggy_plugins["C * AmpVTS"] = 88200;
|
||||
__buggy_plugins["Chorus2"] = 44100;
|
||||
__buggy_plugins["Notch Filter"] = 96000;
|
||||
}
|
||||
if( __buggy_plugins.contains( _name ) )
|
||||
{
|
||||
|
||||
@@ -60,16 +60,6 @@ public:
|
||||
return( m_portControls );
|
||||
}
|
||||
|
||||
virtual inline QString publicName( void ) const
|
||||
{
|
||||
return( m_publicName );
|
||||
}
|
||||
|
||||
inline void setPublicName( const QString & _name )
|
||||
{
|
||||
m_publicName = _name;
|
||||
}
|
||||
|
||||
|
||||
private slots:
|
||||
void changeSampleRate( void );
|
||||
@@ -79,14 +69,13 @@ private:
|
||||
void pluginInstantiation( void );
|
||||
void pluginDestruction( void );
|
||||
|
||||
static int maxSamplerate( const QString & _name );
|
||||
static sample_rate_t maxSamplerate( const QString & _name );
|
||||
|
||||
|
||||
QMutex m_pluginMutex;
|
||||
ladspaControls * m_controls;
|
||||
|
||||
QString m_publicName;
|
||||
int m_maxSampleRate;
|
||||
sample_rate_t m_maxSampleRate;
|
||||
ladspa_key_t m_key;
|
||||
int m_portCount;
|
||||
|
||||
|
||||
@@ -124,32 +124,21 @@ bool stereoEnhancerEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
|
||||
m_seFX.nextSample( s[0], s[1] );
|
||||
|
||||
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )
|
||||
{
|
||||
_buf[f][ch] = d * _buf[f][ch] + w * s[ch];
|
||||
out_sum += _buf[f][ch]*_buf[f][ch];
|
||||
}
|
||||
|
||||
_buf[f][0] = d * _buf[f][0] + w * s[0];
|
||||
_buf[f][1] = d * _buf[f][1] + w * s[1];
|
||||
out_sum += _buf[f][0]*_buf[f][0] + _buf[f][1]*_buf[f][1];
|
||||
|
||||
// Update currFrame
|
||||
m_currFrame += 1;
|
||||
m_currFrame %= DEFAULT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
if( out_sum / _frames <= getGate()+0.00001 )
|
||||
checkGate( out_sum / _frames );
|
||||
if( !isRunning() )
|
||||
{
|
||||
incrementBufferCount();
|
||||
if( getBufferCount() > getTimeout() )
|
||||
{
|
||||
stopRunning();
|
||||
resetBufferCount();
|
||||
clearMyBuffer();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resetBufferCount();
|
||||
//clearMyBuffer();
|
||||
clearMyBuffer();
|
||||
}
|
||||
|
||||
return( isRunning() );
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,8 @@ bool stereoMatrixEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
double out_sum = 0.0;
|
||||
|
||||
for( fpp_t f = 0; f < _frames; ++f )
|
||||
{
|
||||
const float d = getDryLevel();
|
||||
@@ -97,10 +98,12 @@ bool stereoMatrixEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
|
||||
_buf[f][1] += ( m_smControls.m_lrModel.value( f ) * l +
|
||||
m_smControls.m_rrModel.value( f ) * r ) * w;
|
||||
|
||||
out_sum += _buf[f][0]*_buf[f][0] + _buf[f][1]*_buf[f][1];
|
||||
|
||||
}
|
||||
|
||||
checkGate( out_sum / _frames );
|
||||
|
||||
return( isRunning() );
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,28 @@ effect * effect::instantiate( const QString & _plugin_name,
|
||||
|
||||
|
||||
|
||||
void effect::checkGate( double _out_sum )
|
||||
{
|
||||
// Check whether we need to continue processing input. Restart the
|
||||
// counter if the threshold has been exceeded.
|
||||
if( _out_sum <= getGate()+0.000001 )
|
||||
{
|
||||
incrementBufferCount();
|
||||
if( getBufferCount() > getTimeout() )
|
||||
{
|
||||
stopRunning();
|
||||
resetBufferCount();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resetBufferCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
pluginView * effect::instantiateView( QWidget * _parent )
|
||||
{
|
||||
return( new effectView( this, _parent ) );
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "engine.h"
|
||||
#include "automatable_model_templates.h"
|
||||
#include "track.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
|
||||
@@ -190,9 +191,22 @@ bool effectChain::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames )
|
||||
}
|
||||
bool more_effects = FALSE;
|
||||
for( effectList::iterator it = m_effects.begin();
|
||||
it != m_effects.end(); it++ )
|
||||
it != m_effects.end(); ++it )
|
||||
{
|
||||
more_effects |= ( *it )->processAudioBuffer( _buf, _frames );
|
||||
#ifdef LMMS_DEBUG
|
||||
for( int f = 0; f < _frames; ++f )
|
||||
{
|
||||
if( fabs( _buf[f][0] ) > 5 || fabs( _buf[f][1] ) > 5 )
|
||||
{
|
||||
it = m_effects.end()-1;
|
||||
printf( "numerical overflow after processing "
|
||||
"plugin \"%s\"\n", ( *it )->
|
||||
publicName().toAscii().constData() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return( more_effects );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user