[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25656] trunk/blender: Added another three effects that you can use with the Sound to F-Curve modifier , have fun!

Joerg Mueller nexyon at gmail.com
Fri Jan 1 19:45:29 CET 2010


Revision: 25656
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25656
Author:   nexyon
Date:     2010-01-01 19:45:21 +0100 (Fri, 01 Jan 2010)

Log Message:
-----------
Added another three effects that you can use with the Sound to F-Curve modifier, have fun!

Modified Paths:
--------------
    trunk/blender/intern/audaspace/intern/AUD_C-API.cpp
    trunk/blender/intern/audaspace/intern/AUD_C-API.h
    trunk/blender/source/blender/editors/space_graph/graph_edit.c

Added Paths:
-----------
    trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.cpp
    trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.h
    trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.cpp
    trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.h
    trunk/blender/intern/audaspace/FX/AUD_SquareFactory.cpp
    trunk/blender/intern/audaspace/FX/AUD_SquareFactory.h
    trunk/blender/intern/audaspace/FX/AUD_SquareReader.cpp
    trunk/blender/intern/audaspace/FX/AUD_SquareReader.h
    trunk/blender/intern/audaspace/FX/AUD_SumFactory.cpp
    trunk/blender/intern/audaspace/FX/AUD_SumFactory.h
    trunk/blender/intern/audaspace/FX/AUD_SumReader.cpp
    trunk/blender/intern/audaspace/FX/AUD_SumReader.h

Added: trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.cpp
===================================================================
--- trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.cpp	                        (rev 0)
+++ trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.cpp	2010-01-01 18:45:21 UTC (rev 25656)
@@ -0,0 +1,49 @@
+/*
+ * $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 <http://www.gnu.org/licenses/>.
+ *
+ * ***** END LGPL LICENSE BLOCK *****
+ */
+
+#include "AUD_AccumulatorFactory.h"
+#include "AUD_AccumulatorReader.h"
+
+AUD_AccumulatorFactory::AUD_AccumulatorFactory(AUD_IFactory* factory,
+											   bool additive) :
+		AUD_EffectFactory(factory),
+		m_additive(additive) {}
+
+AUD_AccumulatorFactory::AUD_AccumulatorFactory(bool additive) :
+		AUD_EffectFactory(0),
+		m_additive(additive) {}
+
+AUD_IReader* AUD_AccumulatorFactory::createReader()
+{
+	AUD_IReader* reader = getReader();
+
+	if(reader != 0)
+	{
+		reader = new AUD_AccumulatorReader(reader, m_additive);
+		AUD_NEW("reader")
+	}
+
+	return reader;
+}


Property changes on: trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.cpp
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.h
===================================================================
--- trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.h	                        (rev 0)
+++ trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.h	2010-01-01 18:45:21 UTC (rev 25656)
@@ -0,0 +1,59 @@
+/*
+ * $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 <http://www.gnu.org/licenses/>.
+ *
+ * ***** END LGPL LICENSE BLOCK *****
+ */
+
+#ifndef AUD_ACCUMULATORFACTORY
+#define AUD_ACCUMULATORFACTORY
+
+#include "AUD_EffectFactory.h"
+
+/**
+ * This factory creates an accumulator reader.
+ */
+class AUD_AccumulatorFactory : public AUD_EffectFactory
+{
+private:
+	/**
+	 * Whether the accumulator is additive.
+	 */
+	bool m_additive;
+
+public:
+	/**
+	 * Creates a new accumulator factory.
+	 * \param factory The input factory.
+	 * \param additive Whether the accumulator is additive.
+	 */
+	AUD_AccumulatorFactory(AUD_IFactory* factory, bool additive = false);
+
+	/**
+	 * Creates a new accumulator factory.
+	 * \param additive Whether the accumulator is additive.
+	 */
+	AUD_AccumulatorFactory(bool additive = false);
+
+	virtual AUD_IReader* createReader();
+};
+
+#endif //AUD_ACCUMULATORFACTORY


Property changes on: trunk/blender/intern/audaspace/FX/AUD_AccumulatorFactory.h
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.cpp
===================================================================
--- trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.cpp	                        (rev 0)
+++ trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.cpp	2010-01-01 18:45:21 UTC (rev 25656)
@@ -0,0 +1,99 @@
+/*
+ * $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 <http://www.gnu.org/licenses/>.
+ *
+ * ***** END LGPL LICENSE BLOCK *****
+ */
+
+#include "AUD_AccumulatorReader.h"
+#include "AUD_Buffer.h"
+
+#include <cstring>
+
+#define CC specs.channels + channel
+
+AUD_AccumulatorReader::AUD_AccumulatorReader(AUD_IReader* reader,
+											 bool additive) :
+		AUD_EffectReader(reader),
+		m_additive(additive)
+{
+	AUD_Specs specs = reader->getSpecs();
+	int samplesize = AUD_SAMPLE_SIZE(specs);
+
+	m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
+
+	m_sums = new AUD_Buffer(samplesize); AUD_NEW("buffer")
+	memset(m_sums->getBuffer(), 0, samplesize);
+
+	m_prevs = new AUD_Buffer(samplesize); AUD_NEW("buffer")
+	memset(m_prevs->getBuffer(), 0, samplesize);
+}
+
+AUD_AccumulatorReader::~AUD_AccumulatorReader()
+{
+	delete m_buffer; AUD_DELETE("buffer")
+	delete m_sums; AUD_DELETE("buffer")
+	delete m_prevs; AUD_DELETE("buffer")
+}
+
+void AUD_AccumulatorReader::read(int & length, sample_t* & buffer)
+{
+	sample_t* buf;
+	sample_t* sums;
+	sample_t* prevs;
+	sums = m_sums->getBuffer();
+	prevs = m_prevs->getBuffer();
+
+	AUD_Specs specs = m_reader->getSpecs();
+
+	m_reader->read(length, buf);
+	if(m_buffer->getSize() < length * AUD_SAMPLE_SIZE(specs))
+		m_buffer->resize(length * AUD_SAMPLE_SIZE(specs));
+
+	buffer = m_buffer->getBuffer();
+
+	if(m_additive)
+	{
+		for(int channel = 0; channel < specs.channels; channel++)
+		{
+			for(int i = 0; i < length; i++)
+			{
+				if(buf[i * CC] > prevs[channel])
+					sums[channel] += buf[i * CC] - prevs[channel];
+				buffer[i * CC] = sums[channel] + buf[i * CC];
+				prevs[channel] = buf[i * CC];
+			}
+		}
+	}
+	else
+	{
+		for(int channel = 0; channel < specs.channels; channel++)
+		{
+			for(int i = 0; i < length * specs.channels; i++)
+			{
+				if(buf[i * CC] > prevs[channel])
+					sums[channel] += buf[i * CC] - prevs[channel];
+				buffer[i * CC] = sums[channel];
+				prevs[channel] = buf[i * CC];
+			}
+		}
+	}
+}


Property changes on: trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.cpp
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.h
===================================================================
--- trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.h	                        (rev 0)
+++ trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.h	2010-01-01 18:45:21 UTC (rev 25656)
@@ -0,0 +1,75 @@
+/*
+ * $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 <http://www.gnu.org/licenses/>.
+ *
+ * ***** END LGPL LICENSE BLOCK *****
+ */
+
+#ifndef AUD_ACCUMULATORREADER
+#define AUD_ACCUMULATORREADER
+
+#include "AUD_EffectReader.h"
+class AUD_Buffer;
+
+/**
+ * This class represents an accumulator.
+ */
+class AUD_AccumulatorReader : public AUD_EffectReader
+{
+private:
+	/**
+	 * The playback buffer.
+	 */
+	AUD_Buffer *m_buffer;
+
+	/**
+	 * The sums of the specific channels.
+	 */
+	AUD_Buffer *m_sums;
+
+	/**
+	 * The previous results of the specific channels.
+	 */
+	AUD_Buffer *m_prevs;
+
+	/**
+	 * Whether the accumulator is additive.
+	 */
+	bool m_additive;
+
+public:
+	/**
+	 * Creates a new accumulator reader.
+	 * \param reader The reader to read from.
+	 * \param additive Whether the accumulator is additive.
+	 * \exception AUD_Exception Thrown if the reader specified is NULL.
+	 */
+	AUD_AccumulatorReader(AUD_IReader* reader, bool additive);
+
+	/**
+	 * Destroys the reader.
+	 */
+	virtual ~AUD_AccumulatorReader();
+
+	virtual void read(int & length, sample_t* & buffer);
+};
+
+#endif //AUD_ACCUMULATORREADER


Property changes on: trunk/blender/intern/audaspace/FX/AUD_AccumulatorReader.h
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: trunk/blender/intern/audaspace/FX/AUD_SquareFactory.cpp
===================================================================
--- trunk/blender/intern/audaspace/FX/AUD_SquareFactory.cpp	                        (rev 0)
+++ trunk/blender/intern/audaspace/FX/AUD_SquareFactory.cpp	2010-01-01 18:45:21 UTC (rev 25656)
@@ -0,0 +1,57 @@
+/*
+ * $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

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list