Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/audaspace/FX/AUD_LowpassFactory.cpp')
-rw-r--r--intern/audaspace/FX/AUD_LowpassFactory.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/intern/audaspace/FX/AUD_LowpassFactory.cpp b/intern/audaspace/FX/AUD_LowpassFactory.cpp
index d24a04b5a94..3ef25c3c16e 100644
--- a/intern/audaspace/FX/AUD_LowpassFactory.cpp
+++ b/intern/audaspace/FX/AUD_LowpassFactory.cpp
@@ -38,30 +38,26 @@
#define M_PI 3.14159265358979323846
#endif
-AUD_LowpassFactory::AUD_LowpassFactory(AUD_IFactory* factory, float frequency,
+AUD_LowpassFactory::AUD_LowpassFactory(AUD_Reference<AUD_IFactory> factory, float frequency,
float Q) :
- AUD_EffectFactory(factory),
+ AUD_DynamicIIRFilterFactory(factory),
m_frequency(frequency),
m_Q(Q)
{
}
-AUD_IReader* AUD_LowpassFactory::createReader() const
+void AUD_LowpassFactory::recalculateCoefficients(AUD_SampleRate rate,
+ std::vector<float> &b,
+ std::vector<float> &a)
{
- AUD_IReader* reader = getReader();
-
- // calculate coefficients
- float w0 = 2 * M_PI * m_frequency / reader->getSpecs().rate;
+ float w0 = 2 * M_PI * m_frequency / rate;
float alpha = sin(w0) / (2 * m_Q);
float norm = 1 + alpha;
float c = cos(w0);
- std::vector<float> a, b;
a.push_back(1);
a.push_back(-2 * c / norm);
a.push_back((1 - alpha) / norm);
b.push_back((1 - c) / (2 * norm));
b.push_back((1 - c) / norm);
b.push_back(b[0]);
-
- return new AUD_IIRFilterReader(reader, b, a);
}