* added missing includes to compile with GCC 4.4
* optimized various loops for getting tree-vectorized, especially with upcoming GCC 4.4 git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1733 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -54,7 +54,7 @@ plugin::descriptor PLUGIN_EXPORT bassbooster_plugin_descriptor =
|
||||
bassBoosterEffect::bassBoosterEffect( model * _parent,
|
||||
const descriptor::subPluginFeatures::key * _key ) :
|
||||
effect( &bassbooster_plugin_descriptor, _parent, _key ),
|
||||
m_bbFX( effectLib::fastBassBoost<>( 70.0f, 1.0f, 2.8f ) ),
|
||||
m_bbFX( effectLib::fastBassBoost( 70.0f, 1.0f, 2.8f ) ),
|
||||
m_bbControls( this )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
effectLib::monoToStereoAdaptor<effectLib::fastBassBoost<> > m_bbFX;
|
||||
effectLib::monoToStereoAdaptor<effectLib::fastBassBoost> m_bbFX;
|
||||
|
||||
bassBoosterControls m_bbControls;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ bSynth::bSynth( float * _shape, int _length, notePlayHandle * _nph, bool _interp
|
||||
interpolation( _interpolation)
|
||||
{
|
||||
sample_shape = new float[sample_length];
|
||||
for (int i=0; i < _length; i++)
|
||||
for (int i=0; i < _length; ++i)
|
||||
{
|
||||
sample_shape[i] = _shape[i] * _factor;
|
||||
}
|
||||
@@ -241,7 +241,8 @@ void bitInvader::normalize( void )
|
||||
const float* samples = m_graph.samples();
|
||||
for(int i=0; i < m_graph.length(); i++)
|
||||
{
|
||||
if (fabsf(samples[i]) > max) { max = fabs(samples[i]); }
|
||||
const float f = fabsf( samples[i] );
|
||||
if (f > max) { max = f; }
|
||||
}
|
||||
normalizeFactor = 1.0 / max;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ QString kickerInstrument::nodeName( void ) const
|
||||
|
||||
|
||||
//typedef effectLib::foldbackDistortion<> distFX;
|
||||
typedef effectLib::distortion<> distFX;
|
||||
typedef effectLib::distortion distFX;
|
||||
typedef sweepOscillator<effectLib::monoToStereoAdaptor<distFX> > sweepOsc;
|
||||
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ lb302FilterIIR2::lb302FilterIIR2(lb302FilterKnobState* p_fs) :
|
||||
vcf_c(1)
|
||||
{
|
||||
|
||||
m_dist = new effectLib::distortion<>( 1.0, 1.0f);
|
||||
m_dist = new effectLib::distortion( 1.0, 1.0f);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -94,8 +94,7 @@ class lb302FilterIIR2 : public lb302Filter
|
||||
vcf_b, //
|
||||
vcf_c;
|
||||
|
||||
effectLib::monoToStereoAdaptor<effectLib::distortion<> > * m_dist_fx;
|
||||
effectLib::distortion<> * m_dist;
|
||||
effectLib::distortion * m_dist;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -104,7 +104,12 @@ bool peakControllerEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
{
|
||||
for( int i = 0; i < _frames; ++i )
|
||||
{
|
||||
// is this really RMS???
|
||||
sum += (_buf[i][0]+_buf[i][0]) * (_buf[i][1]+_buf[i][1]);
|
||||
}
|
||||
// eases vectorization
|
||||
for( int i = 0; i < _frames; ++i )
|
||||
{
|
||||
_buf[i][0] = _buf[i][1] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,20 +32,19 @@
|
||||
#include "embed.h"
|
||||
|
||||
|
||||
inline void darken( QImage & _i, int _x, int _y, int _w, int _h )
|
||||
static inline void darken( QImage & _i, int _x, int _y, int _w, int _h )
|
||||
{
|
||||
uchar * d = _i.scanLine( _y ) + _x * sizeof( QRgb );
|
||||
const int add = ( _i.width() - _w ) * sizeof( QRgb );
|
||||
const int w = _i.width();
|
||||
QRgb * base = ( (QRgb *) _i.bits() ) + _y*w + _x;
|
||||
for( int y = 0; y < _h; ++y )
|
||||
{
|
||||
QRgb * d = base + y*w;
|
||||
for( int x = 0; x < _w; ++x )
|
||||
{
|
||||
*d = *d >> 1; ++d;
|
||||
*d = *d >> 1; ++d;
|
||||
*d = *d >> 1; ++d;
|
||||
++d;
|
||||
// shift each color component by 1 bit and set alpha
|
||||
// to 0xff
|
||||
d[x] = ( ( d[x] >> 1 ) & 0x7f7f7f7f ) | 0xff000000;
|
||||
}
|
||||
d += add;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,60 +86,54 @@ public:
|
||||
float * b = m_sa->m_bands;
|
||||
const int LOWER_Y = -60; // dB
|
||||
int h;
|
||||
const int fh = height();
|
||||
if( m_sa->m_saControls.m_linearSpec.value() )
|
||||
{
|
||||
for( int x = 0; x < MAX_BANDS; ++x, ++b )
|
||||
if( lin_y )
|
||||
{
|
||||
if( lin_y )
|
||||
for( int x = 0; x < MAX_BANDS; ++x, ++b )
|
||||
{
|
||||
h = height() * 2.0 / 3.0 * (*b / e );
|
||||
h = fh * 2.0 / 3.0 * (*b / e );
|
||||
if( h < 0 ) h = 0; else if( h >= fh ) continue;
|
||||
darken( i, x, 0, 1, fh-h );
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int x = 0; x < MAX_BANDS; ++x, ++b )
|
||||
{
|
||||
h = (int)( height() * 2.0 / 3.0 * (20*(log10( *b / e ) ) - LOWER_Y ) / (-LOWER_Y ) );
|
||||
h = (int)( fh * 2.0 / 3.0 * (20*(log10( *b / e ) ) - LOWER_Y ) / (-LOWER_Y ) );
|
||||
if( h < 0 ) h = 0; else if( h >= fh ) continue;
|
||||
darken( i, x, 0, 1, fh-h );
|
||||
}
|
||||
if( h < 0 )
|
||||
{
|
||||
h = 0;
|
||||
}
|
||||
else if( h > height() )
|
||||
{
|
||||
h = height();
|
||||
}
|
||||
darken( i, x, 0, 1, height()-h );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int x = 0; x < 31; ++x, ++b )
|
||||
if( lin_y )
|
||||
{
|
||||
if( lin_y )
|
||||
for( int x = 0; x < 31; ++x, ++b )
|
||||
{
|
||||
h = height() * 2.0 / 3.0 * ( 1.2 * *b / e );
|
||||
h = fh * 2.0 / 3.0 * ( 1.2 * *b / e );
|
||||
if( h < 0 ) h = 0; else if( h >= fh ) continue; else h = ( h / 3 ) * 3;
|
||||
darken( i, x*8, 0, 8, fh-h );
|
||||
}
|
||||
else
|
||||
{
|
||||
h = (int)( height() * 2.0 / 3.0 * (20*(log10( *b / e ) ) - LOWER_Y ) / (-LOWER_Y ) );
|
||||
}
|
||||
if( h < 0 )
|
||||
{
|
||||
h = 0;
|
||||
}
|
||||
else if( h > height() )
|
||||
{
|
||||
h = height();
|
||||
}
|
||||
else
|
||||
{
|
||||
h = ( h / 3 ) * 3;
|
||||
}
|
||||
darken( i, x*8, 0, 8, height()-h );
|
||||
}
|
||||
darken( i, 31*8, 0, 1, height() );
|
||||
else
|
||||
{
|
||||
for( int x = 0; x < 31; ++x, ++b )
|
||||
{
|
||||
h = (int)( fh * 2.0 / 3.0 * (20*(log10( *b / e ) ) - LOWER_Y ) / (-LOWER_Y ) );
|
||||
if( h < 0 ) h = 0; else if( h >= fh ) continue; else h = ( h / 3 ) * 3;
|
||||
darken( i, x*8, 0, 8, fh-h );
|
||||
}
|
||||
}
|
||||
darken( i, 31*8, 0, 1, fh );
|
||||
}
|
||||
p.drawImage( 0, 0, i );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
spectrumAnalyzer * m_sa;
|
||||
QImage m_backgroundPlain;
|
||||
|
||||
@@ -55,7 +55,7 @@ stereoEnhancerEffect::stereoEnhancerEffect(
|
||||
model * _parent,
|
||||
const descriptor::subPluginFeatures::key * _key ) :
|
||||
effect( &stereoenhancer_plugin_descriptor, _parent, _key ),
|
||||
m_seFX( effectLib::stereoEnhancer<>( 0.0f ) ),
|
||||
m_seFX( effectLib::stereoEnhancer( 0.0f ) ),
|
||||
m_delayBuffer( new sampleFrame[DEFAULT_BUFFER_SIZE] ),
|
||||
m_currFrame( 0 ),
|
||||
m_bbControls( this )
|
||||
@@ -107,13 +107,13 @@ bool stereoEnhancerEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
// copy samples into the delay buffer
|
||||
m_delayBuffer[m_currFrame][0] = _buf[f][0];
|
||||
m_delayBuffer[m_currFrame][1] = _buf[f][1];
|
||||
|
||||
|
||||
// Get the width knob value from the Stereo Enhancer effect
|
||||
width = m_seFX.getWideCoeff();
|
||||
|
||||
|
||||
// Calculate the correct sample frame for processing
|
||||
frameIndex = m_currFrame - width;
|
||||
|
||||
|
||||
if( frameIndex < 0 )
|
||||
{
|
||||
// e.g. difference = -10, frameIndex = DBS - 10
|
||||
@@ -122,7 +122,7 @@ bool stereoEnhancerEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
|
||||
//sample_t s[2] = { _buf[f][0], _buf[f][1] }; //Vanilla
|
||||
sample_t s[2] = { _buf[f][0], m_delayBuffer[frameIndex][1] }; //Chocolate
|
||||
|
||||
|
||||
m_seFX.nextSample( s[0], s[1] );
|
||||
|
||||
_buf[f][0] = d * _buf[f][0] + w * s[0];
|
||||
@@ -154,7 +154,7 @@ void stereoEnhancerEffect::clearMyBuffer()
|
||||
m_delayBuffer[i][0] = 0.0f;
|
||||
m_delayBuffer[i][1] = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
m_currFrame = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
effectLib::stereoEnhancer<> m_seFX;
|
||||
effectLib::stereoEnhancer m_seFX;
|
||||
|
||||
sampleFrame * m_delayBuffer;
|
||||
int m_currFrame;
|
||||
|
||||
@@ -91,32 +91,35 @@ bool vstEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames )
|
||||
|
||||
if( m_plugin )
|
||||
{
|
||||
const float d = getDryLevel();
|
||||
#ifdef __GNUC__
|
||||
sampleFrame buf[_frames];
|
||||
#else
|
||||
sampleFrame * buf = new sampleFrame[_frames];
|
||||
for( fpp_t f = 0; f < _frames; ++f )
|
||||
{
|
||||
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )
|
||||
{
|
||||
buf[f][ch] = _buf[f][ch];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
memcpy( buf, _buf, sizeof( sampleFrame ) * _frames );
|
||||
m_pluginMutex.lock();
|
||||
m_plugin->process( buf, buf );
|
||||
m_pluginMutex.unlock();
|
||||
|
||||
double out_sum = 0.0;
|
||||
const float d = getDryLevel();
|
||||
const float w = getWetLevel();
|
||||
for( fpp_t f = 0; f < _frames; ++f )
|
||||
{
|
||||
_buf[f][0] = d * _buf[f][0] + w * buf[f][0];
|
||||
_buf[f][1] = d * _buf[f][1] + w * buf[f][1];
|
||||
_buf[f][0] = w*buf[f][0] + d*_buf[f][0];
|
||||
_buf[f][1] = w*buf[f][1] + d*_buf[f][1];
|
||||
}
|
||||
for( fpp_t f = 0; f < _frames; ++f )
|
||||
{
|
||||
out_sum += _buf[f][0]*_buf[f][0] + _buf[f][1]*_buf[f][1];
|
||||
}
|
||||
#ifndef __GNUC__
|
||||
delete[] buf;
|
||||
#endif
|
||||
|
||||
checkGate( out_sum / _frames );
|
||||
}
|
||||
return( isRunning() );
|
||||
return isRunning();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user