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>2010-08-02 02:33:50 +0400
committerJoerg Mueller <nexyon@gmail.com>2010-08-02 02:33:50 +0400
commit52ef66da4d785414e7ae5a60dd44a01727514169 (patch)
treecb9a26f84277abae1a4f47ef6f445a4ef0466587 /intern/audaspace/FX/AUD_SquareFactory.cpp
parent5c9cf81cf98c99e52064b0cd45be3b2eaba9e40c (diff)
Audaspace:
* Created awesome filter classes :) * Made all filter effects use the filter classes instead of having the same implementation everywhere. * Added a Python API for LTI IIR filters. * Fixed a warning in creator.c that was introduced when adding game autoplay.
Diffstat (limited to 'intern/audaspace/FX/AUD_SquareFactory.cpp')
-rw-r--r--intern/audaspace/FX/AUD_SquareFactory.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/intern/audaspace/FX/AUD_SquareFactory.cpp b/intern/audaspace/FX/AUD_SquareFactory.cpp
index b95c9d9bb0f..c321a13d79a 100644
--- a/intern/audaspace/FX/AUD_SquareFactory.cpp
+++ b/intern/audaspace/FX/AUD_SquareFactory.cpp
@@ -24,7 +24,23 @@
*/
#include "AUD_SquareFactory.h"
-#include "AUD_SquareReader.h"
+#include "AUD_CallbackIIRFilterReader.h"
+
+sample_t squareFilter(AUD_CallbackIIRFilterReader* reader, float* threshold)
+{
+ float in = reader->x(0);
+ if(in >= *threshold)
+ return 1;
+ else if(in <= -*threshold)
+ return -1;
+ else
+ return 0;
+}
+
+void endSquareFilter(float* threshold)
+{
+ delete threshold;
+}
AUD_SquareFactory::AUD_SquareFactory(AUD_IFactory* factory, float threshold) :
AUD_EffectFactory(factory),
@@ -39,5 +55,8 @@ float AUD_SquareFactory::getThreshold() const
AUD_IReader* AUD_SquareFactory::createReader() const
{
- return new AUD_SquareReader(getReader(), m_threshold);
+ return new AUD_CallbackIIRFilterReader(getReader(), 1, 1,
+ (doFilterIIR) squareFilter,
+ (endFilterIIR) endSquareFilter,
+ new float(m_threshold));
}