mirror of
https://github.com/LMMS/lmms.git
synced 2026-04-22 15:08:35 -04:00
Add usage of linearInterpolate() to several places (mostly my plugins for now but i'll add more if i find them)
This commit is contained in:
@@ -25,7 +25,9 @@
|
||||
|
||||
|
||||
#include "dynamics_processor.h"
|
||||
#include <math.h>
|
||||
#include "lmms_math.h"
|
||||
#include "interpolation.h"
|
||||
|
||||
#include "embed.cpp"
|
||||
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
@@ -107,8 +109,7 @@ bool dynProcEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
|
||||
// variables for effect
|
||||
int i = 0;
|
||||
float lookup;
|
||||
float frac;
|
||||
|
||||
float sm_peak[2] = { 0.0f, 0.0f };
|
||||
float gain;
|
||||
|
||||
@@ -182,22 +183,20 @@ bool dynProcEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
|
||||
for ( i=0; i <= 1; i++ )
|
||||
{
|
||||
if( sm_peak[i] != 0 )
|
||||
const int lookup = static_cast<int>( sm_peak[i] * 200.0f );
|
||||
const float frac = fraction( sm_peak[i] * 200.0f );
|
||||
|
||||
if( sm_peak[i] > 0 )
|
||||
{
|
||||
lookup = sm_peak[i] * 200.0f;
|
||||
|
||||
if ( lookup < 1 )
|
||||
{
|
||||
frac = lookup - truncf(lookup);
|
||||
gain = frac * m_dpControls.m_wavegraphModel.samples()[0];
|
||||
}
|
||||
else
|
||||
if ( lookup < 200 )
|
||||
{
|
||||
frac = lookup - truncf(lookup);
|
||||
gain =
|
||||
(( (1.0f-frac) * m_dpControls.m_wavegraphModel.samples()[ (int)truncf(lookup) - 1 ] ) +
|
||||
( frac * m_dpControls.m_wavegraphModel.samples()[ (int)truncf(lookup) ] ));
|
||||
gain = linearInterpolate( m_dpControls.m_wavegraphModel.samples()[ lookup - 1 ],
|
||||
m_dpControls.m_wavegraphModel.samples()[ lookup ], frac );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -206,8 +205,6 @@ bool dynProcEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
|
||||
s[i] *= ( gain / sm_peak[i] );
|
||||
}
|
||||
else { s[i] = 0.0f; }
|
||||
|
||||
}
|
||||
|
||||
// apply output gain
|
||||
|
||||
Reference in New Issue
Block a user