* 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:
@@ -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() );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user