Fixed issues with original verion, as directed in pull request.

corrected the typeo's,
 Used sampleFrame instead of float* making the code cleaner.
 Set up a socket to change the samplerate where required.
 Stopped using malloc ( yeah that was bad practice on my part ).
 Now using lmms_Math.h and the predefined versions of F_PI and F_2PI,
 I didn't know data from the knobs etc. was not updated over the course of a buffer, so have moved outside the processing loop,
 made appropriate functions inline,
 used sinf.
 Multiplication has replaced division where possible,
 zeroing of the buffer has been removed, as redundant.
This commit is contained in:
dave committed 2014-11-16 15:02:15 +00:00
1 parent 6d2b91054b
commit 4c82ba22a9
10 files changed
+115 -104

No files matched your search

+16 -5
View File
@@ -51,12 +51,14 @@ DelayEffect::DelayEffect( Model* parent, const Plugin::Descriptor::SubPluginFeat
m_delayControls( this )
{
m_delay = 0;
m_delay = new StereoDelay( engine::mixer()->processingSampleRate()* 20 );
m_delay = new StereoDelay( 192000 * 20 );
m_lfo = new Lfo( engine::mixer()->processingSampleRate() );
connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) );
}
DelayEffect::~DelayEffect()
{
if( m_delay )
@@ -81,16 +83,16 @@ bool DelayEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
double outSum = 0.0;
const float d = dryLevel();
const float w = wetLevel();
m_lfo->setAmplitude( m_delayControls.m_lfoAmountModel.value() );
m_lfo->setFrequency( 1.0 / m_delayControls.m_lfoTimeModel.value() );
m_delay->setFeedback( m_delayControls.m_feedbackModel.value() );
sample_t dryS[2];
for( fpp_t f = 0; f < frames; ++f )
{
dryS[0] = buf[f][0];
dryS[1] = buf[f][1];
m_lfo->setAmplitude( m_delayControls.m_lfoAmmountModel.value( f ) );
m_lfo->setFrequency( 1.0 / m_delayControls.m_lfoTimeModel.value( f ) );
m_delay->setLength( m_delayControls.m_delayTimeModel.value(f) * engine::mixer()->processingSampleRate() * m_lfo->tick() );
m_delay->setFeedback( m_delayControls.m_feebackModel.value( f ) );
m_delay->tick( &buf[f][0], &buf[f][1] );
m_delay->tick( buf[f] );
buf[f][0] = ( d * dryS[0] ) + ( w * buf[f][0] );
buf[f][1] = ( d * dryS[1] ) + ( w * buf[f][1] );
@@ -102,6 +104,15 @@ bool DelayEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
void DelayEffect::sampleRateChanged()
{
m_lfo->setSamplerate(engine::mixer()->processingSampleRate());
}
extern "C"
{