From 99bbc90266beeedd432981d7332a04ebafae413c Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sat, 19 Jun 2010 10:31:47 +0000 Subject: Deleting my GSoC branch to recreate it. --- intern/audaspace/FX/AUD_SquareFactory.cpp | 57 ------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 intern/audaspace/FX/AUD_SquareFactory.cpp (limited to 'intern/audaspace/FX/AUD_SquareFactory.cpp') diff --git a/intern/audaspace/FX/AUD_SquareFactory.cpp b/intern/audaspace/FX/AUD_SquareFactory.cpp deleted file mode 100644 index 638acaa9a32..00000000000 --- a/intern/audaspace/FX/AUD_SquareFactory.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN LGPL LICENSE BLOCK ***** - * - * Copyright 2009 Jörg Hermann Müller - * - * This file is part of AudaSpace. - * - * AudaSpace is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AudaSpace is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with AudaSpace. If not, see . - * - * ***** END LGPL LICENSE BLOCK ***** - */ - -#include "AUD_SquareFactory.h" -#include "AUD_SquareReader.h" - -AUD_SquareFactory::AUD_SquareFactory(AUD_IFactory* factory, float threshold) : - AUD_EffectFactory(factory), - m_threshold(threshold) {} - -AUD_SquareFactory::AUD_SquareFactory(float threshold) : - AUD_EffectFactory(0), - m_threshold(threshold) {} - -float AUD_SquareFactory::getThreshold() -{ - return m_threshold; -} - -void AUD_SquareFactory::setThreshold(float threshold) -{ - m_threshold = threshold; -} - -AUD_IReader* AUD_SquareFactory::createReader() -{ - AUD_IReader* reader = getReader(); - - if(reader != 0) - { - reader = new AUD_SquareReader(reader, m_threshold); AUD_NEW("reader") - } - - return reader; -} -- cgit v1.2.3 From 7296600434c49b40215ba842af73a8b1517e12eb Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Wed, 28 Jul 2010 09:36:03 +0000 Subject: Audaspace: HUGE Refactor. Some points of the refactor not sorted by importance: * Fixed immutability of readers and factories (there are exceptions...) * Fixed copy constructors and = operators * Removed messaging system * Removed reader types * Added const where possible * Using initalisers when possible * Avoided use of pointers when possible * Removed AUD_NEW and AUD_DELETE macros * Removed useless NULL pointer checks * Fixed exception catching * Fixed some yet unknown bugs * Lots of other stuff --- intern/audaspace/FX/AUD_SquareFactory.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'intern/audaspace/FX/AUD_SquareFactory.cpp') diff --git a/intern/audaspace/FX/AUD_SquareFactory.cpp b/intern/audaspace/FX/AUD_SquareFactory.cpp index 638acaa9a32..b95c9d9bb0f 100644 --- a/intern/audaspace/FX/AUD_SquareFactory.cpp +++ b/intern/audaspace/FX/AUD_SquareFactory.cpp @@ -28,30 +28,16 @@ AUD_SquareFactory::AUD_SquareFactory(AUD_IFactory* factory, float threshold) : AUD_EffectFactory(factory), - m_threshold(threshold) {} - -AUD_SquareFactory::AUD_SquareFactory(float threshold) : - AUD_EffectFactory(0), - m_threshold(threshold) {} - -float AUD_SquareFactory::getThreshold() + m_threshold(threshold) { - return m_threshold; } -void AUD_SquareFactory::setThreshold(float threshold) +float AUD_SquareFactory::getThreshold() const { - m_threshold = threshold; + return m_threshold; } -AUD_IReader* AUD_SquareFactory::createReader() +AUD_IReader* AUD_SquareFactory::createReader() const { - AUD_IReader* reader = getReader(); - - if(reader != 0) - { - reader = new AUD_SquareReader(reader, m_threshold); AUD_NEW("reader") - } - - return reader; + return new AUD_SquareReader(getReader(), m_threshold); } -- cgit v1.2.3 From 52ef66da4d785414e7ae5a60dd44a01727514169 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sun, 1 Aug 2010 22:33:50 +0000 Subject: 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. --- intern/audaspace/FX/AUD_SquareFactory.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'intern/audaspace/FX/AUD_SquareFactory.cpp') 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)); } -- cgit v1.2.3