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:
authorJoerg Mueller <nexyon@gmail.com>2011-06-22 00:35:09 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-06-22 00:35:09 +0400
commit8e6b5598e075932cab09048bff7ef1e54d657bb8 (patch)
treead78c4493b1ed29fe82d750c5188ea578c5ec601 /intern/audaspace/FX/AUD_LowpassFactory.cpp
parent6d5b224184bbd891b40fb0a313e2cc0e9d96a778 (diff)
3D Audio GSoC:
Adapting all readers to maximally support dynamic resampling/rechanneling, introducing a DynamicIIRFilter for example.
Diffstat (limited to 'intern/audaspace/FX/AUD_LowpassFactory.cpp')
-rw-r--r--intern/audaspace/FX/AUD_LowpassFactory.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/intern/audaspace/FX/AUD_LowpassFactory.cpp b/intern/audaspace/FX/AUD_LowpassFactory.cpp
index 9bc8d7cfe21..3ef25c3c16e 100644
--- a/intern/audaspace/FX/AUD_LowpassFactory.cpp
+++ b/intern/audaspace/FX/AUD_LowpassFactory.cpp
@@ -40,28 +40,24 @@
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_Reference<AUD_IReader> AUD_LowpassFactory::createReader()
+void AUD_LowpassFactory::recalculateCoefficients(AUD_SampleRate rate,
+ std::vector<float> &b,
+ std::vector<float> &a)
{
- AUD_Reference<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);
}