* 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:
Tobias Doerffel
2008-10-04 14:27:55 +00:00
parent 30a452fd5d
commit 13c00f55a1
26 changed files with 257 additions and 190 deletions

View File

@@ -1,3 +1,43 @@
2008-10-04 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/lb302/lb302.cpp:
* plugins/lb302/lb302.h:
* plugins/bass_booster/bass_booster.cpp:
* plugins/bass_booster/bass_booster.h:
* plugins/bit_invader/bit_invader.cpp:
* plugins/vst_effect/vst_effect.cpp:
* plugins/peak_controller_effect/peak_controller_effect.cpp:
* plugins/stereo_enhancer/stereo_enhancer.cpp:
* plugins/stereo_enhancer/stereo_enhancer.h:
* plugins/spectrum_analyzer/spectrumanalyzer_control_dialog.cpp:
* plugins/kicker/kicker.cpp:
* include/sweep_oscillator.h:
* include/envelope_and_lfo_parameters.h:
* include/remote_plugin.h:
* include/types.h:
* src/core/midi/midi_client.cpp:
* src/core/journalling_object.cpp:
* src/core/audio/audio_pulseaudio.cpp:
* src/core/envelope_and_lfo_parameters.cpp:
* src/core/instrument_sound_shaping.cpp:
* src/core/effect.cpp:
* src/core/ladspa_control.cpp:
* src/core/peak_controller.cpp:
* src/gui/widgets/visualization_widget.cpp:
* src/gui/widgets/tempo_sync_knob.cpp:
- added missing includes to compile with GCC 4.4
- optimized various loops for getting tree-vectorized, especially with
upcoming GCC 4.4
* CMakeLists.txt:
use -ftree-vectorize per default - everyone compiling LMMS (which
needs Qt >= 4.3.0) will at least have GCC 4.1, anyways only makes
sense when setting C(XX)FLAGS=-march=...
* include/effect_lib.h:
improved effectLib for not being based on virtual-functions rather than
direct function-inlining via template parameter
2008-10-02 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/lb302/lb302.h:

View File

@@ -142,7 +142,6 @@ private:
NumLfoShapes
} ;
sample_t lfoShapeSample( fpp_t _frame_offset );
void updateLFOShapeData( void );

View File

@@ -30,6 +30,7 @@
#include "midi.h"
#include <vector>
#include <cstdio>
#include <cstring>
#include <string>
#include <cassert>

View File

@@ -30,7 +30,7 @@
#include "effect_lib.h"
template<class FX = effectLib::stereoBypass<> >
template<class FX = effectLib::stereoBypass>
class sweepOscillator
{
public:
@@ -51,11 +51,9 @@ public:
const float df = _freq2 - _freq1;
for( fpp_t frame = 0; frame < _frames; ++frame )
{
sample_t s = oscillator::sinSample( m_phase );
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )
{
_ab[frame][ch] = s;
}
const sample_t s = oscillator::sinSample( m_phase );
_ab[frame][0] = s;
_ab[frame][1] = s;
m_FX.nextSample( _ab[frame][0], _ab[frame][1] );
m_phase += ( _freq1 + ( frame * df / _frames ) ) /
_sample_rate;

View File

@@ -30,6 +30,10 @@
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_STDINT_H
#include <stdint.h>
#endif
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
@@ -127,6 +131,8 @@ const ch_cnt_t SURROUND_CHANNELS =
typedef sample_t sampleFrame[DEFAULT_CHANNELS];
typedef sample_t surroundSampleFrame[SURROUND_CHANNELS];
#if __GNUC__
typedef sample_t sampleFrameA[DEFAULT_CHANNELS] __attribute__((__aligned__(16)));
#endif
#endif

View File

@@ -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 )
{
}

View File

@@ -48,7 +48,7 @@ public:
private:
effectLib::monoToStereoAdaptor<effectLib::fastBassBoost<> > m_bbFX;
effectLib::monoToStereoAdaptor<effectLib::fastBassBoost> m_bbFX;
bassBoosterControls m_bbControls;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);
};

View File

@@ -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;
};

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -52,7 +52,7 @@ public:
private:
effectLib::stereoEnhancer<> m_seFX;
effectLib::stereoEnhancer m_seFX;
sampleFrame * m_delayBuffer;
int m_currFrame;

View File

@@ -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();
}

View File

@@ -29,6 +29,7 @@
#include <QtGui/QLineEdit>
#include <QtGui/QLabel>
#include <cstdio>
#include "audio_pulseaudio.h"

View File

@@ -28,6 +28,8 @@
#include <QtXml/QDomElement>
#include <cstdio>
#include "effect.h"
#include "engine.h"
#include "dummy_effect.h"
@@ -172,7 +174,7 @@ void effect::reinitSRC( void )
libsrcInterpolation(),
DEFAULT_CHANNELS, &error ) ) == NULL )
{
printf( "Error: src_new() failed in effect.cpp!\n" );
fprintf( stderr, "Error: src_new() failed in effect.cpp!\n" );
}
}
}
@@ -198,7 +200,7 @@ void effect::resample( int _i, const sampleFrame * _src_buf,
int error;
if( ( error = src_process( m_srcState[_i], &m_srcData[_i] ) ) )
{
printf( "effect::resample(): error while resampling: %s\n",
fprintf( stderr, "effect::resample(): error while resampling: %s\n",
src_strerror( error ) );
}
}

View File

@@ -51,7 +51,7 @@ envelopeAndLFOParameters::envelopeAndLFOParameters(
float _value_for_zero_amount,
model * _parent ) :
model( _parent ),
m_used( FALSE ),
m_used( false ),
m_predelayModel( 0.0, 0.0, 1.0, 0.001, this, tr( "Predelay" ) ),
m_attackModel( 0.0, 0.0, 1.0, 0.001, this, tr( "Attack" ) ),
m_holdModel( 0.5, 0.0, 1.0, 0.001, this, tr( "Hold" ) ),
@@ -72,10 +72,10 @@ envelopeAndLFOParameters::envelopeAndLFOParameters(
tr( "LFO Modulation" ) ),
m_lfoWaveModel( SineWave, 0, NumLfoShapes, this,
tr( "LFO Wave Shape" ) ),
m_x100Model( FALSE, this, tr( "Freq x 100" ) ),
m_controlEnvAmountModel( FALSE, this, tr( "Modulate Env-Amount" ) ),
m_x100Model( false, this, tr( "Freq x 100" ) ),
m_controlEnvAmountModel( false, this, tr( "Modulate Env-Amount" ) ),
m_lfoFrame( 0 ),
m_lfoAmountIsZero( FALSE ),
m_lfoAmountIsZero( false ),
m_lfoShapeData( NULL )
{
s_EaLParametersInstances.push_back( this );
@@ -151,45 +151,39 @@ envelopeAndLFOParameters::~envelopeAndLFOParameters()
inline sample_t envelopeAndLFOParameters::lfoShapeSample( fpp_t _frame_offset )
{
f_cnt_t frame = ( m_lfoFrame + _frame_offset ) % m_lfoOscillationFrames;
const float phase = frame / static_cast<float>(
m_lfoOscillationFrames );
sample_t shape_sample;
switch( m_lfoWaveModel.value() )
{
case TriangleWave:
shape_sample = oscillator::triangleSample( phase );
break;
case SquareWave:
shape_sample = oscillator::squareSample( phase );
break;
case SawWave:
shape_sample = oscillator::sawSample( phase );
break;
case UserDefinedWave:
shape_sample = m_userWave.userWaveSample( phase );
break;
case SineWave:
default:
shape_sample = oscillator::sinSample( phase );
break;
}
return( shape_sample * m_lfoAmount );
}
void envelopeAndLFOParameters::updateLFOShapeData( void )
{
const fpp_t frames = engine::getMixer()->framesPerPeriod();
for( fpp_t offset = 0; offset < frames; ++offset )
const f_cnt_t end_frame = m_lfoFrame+engine::getMixer()->framesPerPeriod();
const float la = m_lfoAmount;
const int wave_model = m_lfoWaveModel.value();
const float lof = m_lfoOscillationFrames;
for( int f = m_lfoFrame; f < end_frame; ++f )
{
m_lfoShapeData[offset] = lfoShapeSample( offset );
const float phase = ( f % m_lfoOscillationFrames ) / lof;
sample_t shape_sample;
switch( wave_model )
{
case TriangleWave:
shape_sample = oscillator::triangleSample( phase );
break;
case SquareWave:
shape_sample = oscillator::squareSample( phase );
break;
case SawWave:
shape_sample = oscillator::sawSample( phase );
break;
case UserDefinedWave:
shape_sample = m_userWave.userWaveSample( phase );
break;
case SineWave:
default:
shape_sample = oscillator::sinSample( phase );
break;
}
m_lfoShapeData[f] = shape_sample * la;
}
m_bad_lfoShapeData = FALSE;
m_bad_lfoShapeData = false;
}
@@ -203,7 +197,7 @@ void envelopeAndLFOParameters::triggerLFO( void )
{
( *it )->m_lfoFrame +=
engine::getMixer()->framesPerPeriod();
( *it )->m_bad_lfoShapeData = TRUE;
( *it )->m_bad_lfoShapeData = true;
}
}
@@ -217,24 +211,20 @@ void envelopeAndLFOParameters::resetLFO( void )
it != v.end(); ++it )
{
( *it )->m_lfoFrame = 0;
( *it )->m_bad_lfoShapeData = TRUE;
( *it )->m_bad_lfoShapeData = true;
}
}
inline void envelopeAndLFOParameters::fillLFOLevel( float * _buf,
void envelopeAndLFOParameters::fillLFOLevel( float * _buf,
f_cnt_t _frame,
const fpp_t _frames )
{
if( m_lfoAmountIsZero || _frame <= m_lfoPredelayFrames )
{
memset( _buf, 0, _frames * sizeof( *_buf ) );
/* for( fpp_t offset = 0; offset < _frames; ++offset )
{
*_buf++ = 0.0f;
}*/
return;
}
_frame -= m_lfoPredelayFrames;
@@ -245,10 +235,15 @@ inline void envelopeAndLFOParameters::fillLFOLevel( float * _buf,
}
fpp_t offset = 0;
for( ; offset < _frames && _frame < m_lfoAttackFrames; ++offset,
++_frame )
const f_cnt_t laf = m_lfoAttackFrames;
float f = _frame;
for( ; offset < _frames; ++offset, ++f )
{
*_buf++ = m_lfoShapeData[offset] * _frame / m_lfoAttackFrames;
if( _frame >= laf )
{
break;
}
*_buf++ = m_lfoShapeData[offset] * _frame / laf;
}
for( ; offset < _frames; ++offset )
{
@@ -270,6 +265,7 @@ void envelopeAndLFOParameters::fillLevel( float * _buf, f_cnt_t _frame,
fillLFOLevel( _buf, _frame, _frames );
const bool control_env_am = m_controlEnvAmountModel.value();
for( fpp_t offset = 0; offset < _frames; ++offset, ++_buf, ++_frame )
{
float env_level;
@@ -296,9 +292,9 @@ void envelopeAndLFOParameters::fillLevel( float * _buf, f_cnt_t _frame,
}
// at this point, *_buf is LFO level
*_buf = m_controlEnvAmountModel.value() ?
env_level * ( 0.5f + *_buf ) :
env_level + *_buf;
*_buf = control_env_am ?
env_level * ( 0.5f + *_buf ) :
env_level + *_buf;
}
}
@@ -411,39 +407,48 @@ void envelopeAndLFOParameters::updateSampleVars( void )
m_pahdEnv = new sample_t[m_pahdFrames];
m_rEnv = new sample_t[m_rFrames];
// strange auto-vectorizer wants local variables
const float aa = m_amountAdd;
const float am = m_amount;
const float sl = m_sustainLevel;
const float afma = attack_frames * am;
const float hold = m_amount + m_amountAdd;
const float rf = m_rFrames;
// fill predelay
for( f_cnt_t i = 0; i < predelay_frames; ++i )
{
m_pahdEnv[i] = m_amountAdd;
m_pahdEnv[i] = aa;
}
// fill attack
f_cnt_t add = predelay_frames;
for( f_cnt_t i = 0; i < attack_frames; ++i )
{
m_pahdEnv[add + i] = ( (float)i / attack_frames ) *
m_amount + m_amountAdd;
m_pahdEnv[add + i] = (float)i / afma + aa;
}
// fill hold
add += attack_frames;
for( f_cnt_t i = 0; i < hold_frames; ++i )
{
m_pahdEnv[add + i] = m_amount + m_amountAdd;
m_pahdEnv[add + i] = hold;
}
// fill decay
add += hold_frames;
for( f_cnt_t i = 0; i < decay_frames; ++i )
{
m_pahdEnv[add + i] = ( m_sustainLevel + ( 1.0f -
(float)i / decay_frames ) *
( 1.0f - m_sustainLevel ) ) *
m_amount + m_amountAdd;
m_pahdEnv[add + i] = ( sl + ( 1.0f - (float)i / decay_frames ) *
( 1.0f - sl ) ) * am + aa;
}
for( f_cnt_t i = 0; i < m_rFrames; ++i )
// fill release
const f_cnt_t rfr = m_rFrames;
const float rfmam = rf * am;
for( f_cnt_t i = 0; i < rfr; ++i )
{
m_rEnv[i] = ( (float)( m_rFrames - i ) / m_rFrames
// * m_sustainLevel
) * m_amount;
m_rEnv[i] = (float)( rf - i ) / rfmam;
}
// save this calculation in real-time-part
@@ -465,21 +470,21 @@ void envelopeAndLFOParameters::updateSampleVars( void )
}
m_lfoAmount = m_lfoAmountModel.value() * 0.5f;
m_used = TRUE;
m_used = true;
if( static_cast<int>( floorf( m_lfoAmount * 1000.0f ) ) == 0 )
{
m_lfoAmountIsZero = TRUE;
m_lfoAmountIsZero = true;
if( static_cast<int>( floorf( m_amount * 1000.0f ) ) == 0 )
{
m_used = FALSE;
m_used = false;
}
}
else
{
m_lfoAmountIsZero = FALSE;
m_lfoAmountIsZero = false;
}
m_bad_lfoShapeData = TRUE;
m_bad_lfoShapeData = true;
emit dataChanged();

View File

@@ -166,33 +166,44 @@ void instrumentSoundShaping::processAudioBuffer( sampleFrame * _ab,
}
_n->m_filter->setFilterType( m_filterModel.value() );
#ifdef __GNUC__
float cut_buf[_frames];
float res_buf[_frames];
#else
float * cut_buf = NULL;
float * res_buf = NULL;
#endif
if( m_envLFOParameters[Cut]->used() )
{
#ifndef __GNUC__
cut_buf = new float[_frames];
#endif
m_envLFOParameters[Cut]->fillLevel( cut_buf, total_frames,
release_begin, _frames );
}
if( m_envLFOParameters[Resonance]->used() )
{
#ifndef __GNUC__
res_buf = new float[_frames];
#endif
m_envLFOParameters[Resonance]->fillLevel( res_buf,
total_frames, release_begin,
_frames );
}
const float fcv = m_filterCutModel.value();
const float frv = m_filterResModel.value();
if( m_envLFOParameters[Cut]->used() &&
m_envLFOParameters[Resonance]->used() )
{
for( fpp_t frame = 0; frame < _frames; ++frame )
{
float new_cut_val = envelopeAndLFOParameters::expKnobVal( cut_buf[frame] ) * CUT_FREQ_MULTIPLIER +
m_filterCutModel.value();
const float new_cut_val = envelopeAndLFOParameters::expKnobVal( cut_buf[frame] ) *
CUT_FREQ_MULTIPLIER + fcv;
float new_res_val = m_filterResModel.value() + RES_MULTIPLIER *
res_buf[frame];
const float new_res_val = frv + RES_MULTIPLIER * res_buf[frame];
if( static_cast<int>( new_cut_val ) != old_filter_cut ||
static_cast<int>( new_res_val*RES_PRECISION ) != old_filter_res )
@@ -202,70 +213,67 @@ void instrumentSoundShaping::processAudioBuffer( sampleFrame * _ab,
old_filter_res = static_cast<int>( new_res_val*RES_PRECISION );
}
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl )
{
_ab[frame][chnl] = _n->m_filter->update( _ab[frame][chnl], chnl );
}
_ab[frame][0] = _n->m_filter->update( _ab[frame][0], 0 );
_ab[frame][1] = _n->m_filter->update( _ab[frame][1], 1 );
}
}
else if( m_envLFOParameters[Cut]->used() )
{
for( fpp_t frame = 0; frame < _frames; ++frame )
{
float new_cut_val = envelopeAndLFOParameters::expKnobVal( cut_buf[frame] ) * CUT_FREQ_MULTIPLIER +
m_filterCutModel.value();
float new_cut_val = envelopeAndLFOParameters::expKnobVal( cut_buf[frame] ) *
CUT_FREQ_MULTIPLIER + fcv;
if( static_cast<int>( new_cut_val ) != old_filter_cut )
{
_n->m_filter->calcFilterCoeffs( new_cut_val, m_filterResModel.value() );
_n->m_filter->calcFilterCoeffs( new_cut_val, frv );
old_filter_cut = static_cast<int>( new_cut_val );
}
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl )
{
_ab[frame][chnl] = _n->m_filter->update( _ab[frame][chnl], chnl );
}
_ab[frame][0] = _n->m_filter->update( _ab[frame][0], 0 );
_ab[frame][1] = _n->m_filter->update( _ab[frame][1], 1 );
}
}
else if( m_envLFOParameters[Resonance]->used() )
{
for( fpp_t frame = 0; frame < _frames; ++frame )
{
float new_res_val = m_filterResModel.value() + RES_MULTIPLIER *
res_buf[frame];
float new_res_val = frv + RES_MULTIPLIER * res_buf[frame];
if( static_cast<int>( new_res_val*RES_PRECISION ) != old_filter_res )
{
_n->m_filter->calcFilterCoeffs( m_filterCutModel.value(), new_res_val );
_n->m_filter->calcFilterCoeffs( fcv, new_res_val );
old_filter_res = static_cast<int>( new_res_val*RES_PRECISION );
}
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl )
{
_ab[frame][chnl] = _n->m_filter->update( _ab[frame][chnl], chnl );
}
_ab[frame][0] = _n->m_filter->update( _ab[frame][0], 0 );
_ab[frame][1] = _n->m_filter->update( _ab[frame][1], 1 );
}
}
else
{
_n->m_filter->calcFilterCoeffs( m_filterCutModel.value(), m_filterResModel.value() );
_n->m_filter->calcFilterCoeffs( fcv, frv );
for( fpp_t frame = 0; frame < _frames; ++frame )
{
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl )
{
_ab[frame][chnl] = _n->m_filter->update( _ab[frame][chnl], chnl );
}
_ab[frame][0] = _n->m_filter->update( _ab[frame][0], 0 );
_ab[frame][1] = _n->m_filter->update( _ab[frame][1], 1 );
}
}
#ifndef __GNUC__
delete[] cut_buf;
delete[] res_buf;
#endif
}
if( m_envLFOParameters[Volume]->used() )
{
#ifdef __GNUC__
float vol_buf[_frames];
#else
float * vol_buf = new float[_frames];
#endif
m_envLFOParameters[Volume]->fillLevel( vol_buf, total_frames,
release_begin, _frames );
@@ -273,13 +281,12 @@ void instrumentSoundShaping::processAudioBuffer( sampleFrame * _ab,
{
float vol_level = vol_buf[frame];
vol_level = vol_level * vol_level;
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS;
++chnl )
{
_ab[frame][chnl] = vol_level * _ab[frame][chnl];
}
_ab[frame][0] = vol_level * _ab[frame][0];
_ab[frame][1] = vol_level * _ab[frame][1];
}
#ifndef __GNUC__
delete[] vol_buf;
#endif
}
/* else if( m_envLFOParameters[Volume]->used() == false && m_envLFOParameters[PANNING]->used() )
@@ -315,13 +322,13 @@ f_cnt_t instrumentSoundShaping::envFrames( const bool _only_vol ) const
}
}
}
return( ret_val );
return ret_val;
}
f_cnt_t instrumentSoundShaping::releaseFrames(void ) const
f_cnt_t instrumentSoundShaping::releaseFrames( void ) const
{
f_cnt_t ret_val = m_envLFOParameters[Volume]->used() ?
m_envLFOParameters[Volume]->releaseFrames() : 0;
@@ -344,7 +351,7 @@ f_cnt_t instrumentSoundShaping::releaseFrames(void ) const
}
}
}
return( ret_val );
return ret_val;
}

View File

@@ -27,6 +27,8 @@
#include <QtXml/QDomElement>
#include <cstdio>
#include "journalling_object.h"
#include "automatable_model.h"
#include "project_journal.h"
@@ -155,8 +157,8 @@ void journallingObject::changeID( jo_id_t _id )
dynamic_cast<automatableModel *>( jo )->
displayName();
}
printf( "JO-ID %d already in use by %s!\n", (int) _id,
used_by.toAscii().constData() );
fprintf( stderr, "JO-ID %d already in use by %s!\n",
(int) _id, used_by.toAscii().constData() );
return;
}
engine::getProjectJournal()->forgetAboutID( id() );

View File

@@ -23,6 +23,7 @@
*
*/
#include <cstdio>
#include "ladspa_control.h"
#include "ladspa_base.h"

View File

@@ -26,8 +26,9 @@
*/
#include <cstdio>
#include "midi_client.h"
/*#include "midi_mapper.h"*/
#include "templates.h"
#include "midi_port.h"
#include "note.h"
@@ -285,7 +286,7 @@ void midiClientRaw::processOutEvent( const midiEvent & _me,
break;
default:
printf( "midiClientRaw: unhandled MIDI-event %d\n",
fprintf( stderr, "midiClientRaw: unhandled MIDI-event %d\n",
(int) _me.m_type );
break;
}

View File

@@ -26,6 +26,7 @@
*/
#include <math.h>
#include <cstdio>
#include <QtXml/QDomElement>
#include <QtCore/QObject>
#include <QtCore/QVector>

View File

@@ -26,6 +26,8 @@
*/
#include <cstdio>
#include "tempo_sync_knob.h"
#include <QtGui/QMouseEvent>

View File

@@ -78,8 +78,8 @@ void visualizationWidget::updateAudioBuffer( void )
engine::getMixer()->lock();
const surroundSampleFrame * c = engine::getMixer()->
currentReadBuffer();
for( f_cnt_t f = 0; f < engine::getMixer()->framesPerPeriod();
++f )
const fpp_t fpp = engine::getMixer()->framesPerPeriod();
for( f_cnt_t f = 0; f < fpp; ++f )
{
m_buffer[f][0] = c[f][0];
m_buffer[f][1] = c[f][1];