[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37715] branches/soc-2011-pepper/intern/ audaspace: 3D Audio GSoC:

Joerg Mueller nexyon at gmail.com
Tue Jun 21 22:32:25 CEST 2011


Revision: 37715
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37715
Author:   nexyon
Date:     2011-06-21 20:32:25 +0000 (Tue, 21 Jun 2011)
Log Message:
-----------
3D Audio GSoC:
Removing unneeded AUD_ResampleFactory.

Modified Paths:
--------------
    branches/soc-2011-pepper/intern/audaspace/CMakeLists.txt
    branches/soc-2011-pepper/intern/audaspace/FX/AUD_PitchReader.cpp
    branches/soc-2011-pepper/intern/audaspace/FX/AUD_PitchReader.h
    branches/soc-2011-pepper/intern/audaspace/SRC/AUD_SRCResampleFactory.cpp
    branches/soc-2011-pepper/intern/audaspace/SRC/AUD_SRCResampleFactory.h
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_LinearResampleFactory.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_LinearResampleFactory.h
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.h

Removed Paths:
-------------
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_ResampleFactory.h

Modified: branches/soc-2011-pepper/intern/audaspace/CMakeLists.txt
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/CMakeLists.txt	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/CMakeLists.txt	2011-06-21 20:32:25 UTC (rev 37715)
@@ -105,7 +105,6 @@
 	intern/AUD_ReadDevice.h
 	intern/AUD_Reference.h
 	intern/AUD_ReferenceHandler.cpp
-	intern/AUD_ResampleFactory.h
 	intern/AUD_ResampleReader.cpp
 	intern/AUD_ResampleReader.h
 	intern/AUD_SequencerFactory.cpp

Modified: branches/soc-2011-pepper/intern/audaspace/FX/AUD_PitchReader.cpp
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/FX/AUD_PitchReader.cpp	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/FX/AUD_PitchReader.cpp	2011-06-21 20:32:25 UTC (rev 37715)
@@ -42,3 +42,13 @@
 	specs.rate *= m_pitch;
 	return specs;
 }
+
+float AUD_PitchReader::getPitch() const
+{
+	return m_pitch;
+}
+
+void AUD_PitchReader::setPitch(float pitch)
+{
+	m_pitch = pitch;
+}

Modified: branches/soc-2011-pepper/intern/audaspace/FX/AUD_PitchReader.h
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/FX/AUD_PitchReader.h	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/FX/AUD_PitchReader.h	2011-06-21 20:32:25 UTC (rev 37715)
@@ -43,7 +43,7 @@
 	/**
 	 * The pitch level.
 	 */
-	const float m_pitch;
+	float m_pitch;
 
 	// hide copy constructor and operator=
 	AUD_PitchReader(const AUD_PitchReader&);
@@ -58,6 +58,9 @@
 	AUD_PitchReader(AUD_Reference<AUD_IReader> reader, float pitch);
 
 	virtual AUD_Specs getSpecs() const;
+
+	float getPitch() const;
+	void setPitch(float pitch);
 };
 
 #endif //AUD_PITCHREADER

Modified: branches/soc-2011-pepper/intern/audaspace/SRC/AUD_SRCResampleFactory.cpp
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/SRC/AUD_SRCResampleFactory.cpp	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/SRC/AUD_SRCResampleFactory.cpp	2011-06-21 20:32:25 UTC (rev 37715)
@@ -34,7 +34,7 @@
 
 AUD_SRCResampleFactory::AUD_SRCResampleFactory(AUD_Reference<AUD_IFactory> factory,
 											   AUD_DeviceSpecs specs) :
-		AUD_ResampleFactory(factory, specs)
+		AUD_MixerFactory(factory, specs)
 {
 }
 

Modified: branches/soc-2011-pepper/intern/audaspace/SRC/AUD_SRCResampleFactory.h
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/SRC/AUD_SRCResampleFactory.h	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/SRC/AUD_SRCResampleFactory.h	2011-06-21 20:32:25 UTC (rev 37715)
@@ -32,13 +32,13 @@
 #ifndef AUD_SRCRESAMPLEFACTORY
 #define AUD_SRCRESAMPLEFACTORY
 
-#include "AUD_ResampleFactory.h"
+#include "AUD_MixerFactory.h"
 
 /**
  * This factory creates a resampling reader that uses libsamplerate for
  * resampling.
  */
-class AUD_SRCResampleFactory : public AUD_ResampleFactory
+class AUD_SRCResampleFactory : public AUD_MixerFactory
 {
 private:
 	// hide copy constructor and operator=

Modified: branches/soc-2011-pepper/intern/audaspace/intern/AUD_LinearResampleFactory.cpp
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/intern/AUD_LinearResampleFactory.cpp	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/intern/AUD_LinearResampleFactory.cpp	2011-06-21 20:32:25 UTC (rev 37715)
@@ -34,7 +34,7 @@
 
 AUD_LinearResampleFactory::AUD_LinearResampleFactory(AUD_Reference<AUD_IFactory> factory,
 													 AUD_DeviceSpecs specs) :
-		AUD_ResampleFactory(factory, specs)
+		AUD_MixerFactory(factory, specs)
 {
 }
 

Modified: branches/soc-2011-pepper/intern/audaspace/intern/AUD_LinearResampleFactory.h
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/intern/AUD_LinearResampleFactory.h	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/intern/AUD_LinearResampleFactory.h	2011-06-21 20:32:25 UTC (rev 37715)
@@ -32,12 +32,12 @@
 #ifndef AUD_LINEARRESAMPLEFACTORY
 #define AUD_LINEARRESAMPLEFACTORY
 
-#include "AUD_ResampleFactory.h"
+#include "AUD_MixerFactory.h"
 
 /**
  * This factory creates a resampling reader that does simple linear resampling.
  */
-class AUD_LinearResampleFactory : public AUD_ResampleFactory
+class AUD_LinearResampleFactory : public AUD_MixerFactory
 {
 private:
 	// hide copy constructor and operator=

Deleted: branches/soc-2011-pepper/intern/audaspace/intern/AUD_ResampleFactory.h
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/intern/AUD_ResampleFactory.h	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/intern/AUD_ResampleFactory.h	2011-06-21 20:32:25 UTC (rev 37715)
@@ -1,39 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * Copyright 2009-2011 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 General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Audaspace; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file audaspace/intern/AUD_ResampleFactory.h
- *  \ingroup audaspaceintern
- */
-
-
-#ifndef AUD_RESAMPLEFACTORY
-#define AUD_RESAMPLEFACTORY
-
-#include "AUD_MixerFactory.h"
-
-typedef AUD_MixerFactory AUD_ResampleFactory;
-
-#endif //AUD_RESAMPLEFACTORY

Modified: branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.cpp
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.cpp	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.cpp	2011-06-21 20:32:25 UTC (rev 37715)
@@ -45,8 +45,8 @@
 
 typedef std::list<AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> >::iterator AUD_HandleIterator;
 
-AUD_SoftwareDevice::AUD_SoftwareHandle::AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, bool keep) :
-	m_reader(reader), m_keep(keep), m_volume(1.0f), m_loopcount(0),
+AUD_SoftwareDevice::AUD_SoftwareHandle::AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_PitchReader> pitch, bool keep) :
+	m_reader(reader), m_pitch(pitch), m_keep(keep), m_volume(1.0f), m_loopcount(0),
 	m_stop(NULL), m_stop_data(NULL), m_status(AUD_STATUS_PLAYING), m_device(device)
 {
 }
@@ -192,12 +192,13 @@
 
 float AUD_SoftwareDevice::AUD_SoftwareHandle::getPitch()
 {
-	return std::numeric_limits<float>::quiet_NaN();
+	return m_pitch->getPitch();
 }
 
 bool AUD_SoftwareDevice::AUD_SoftwareHandle::setPitch(float pitch)
 {
-	return false;
+	m_pitch->setPitch(pitch);
+	return true;
 }
 
 int AUD_SoftwareDevice::AUD_SoftwareHandle::getLoopCount()
@@ -358,6 +359,11 @@
 AUD_Reference<AUD_IHandle> AUD_SoftwareDevice::play(AUD_Reference<AUD_IReader> reader, bool keep)
 {
 	// prepare the reader
+	// pitch
+
+	AUD_Reference<AUD_PitchReader> pitch = new AUD_PitchReader(reader, 1);
+	reader = AUD_Reference<AUD_IReader>(pitch);
+
 	// resample
 	#ifdef WITH_SAMPLERATE
 		reader = new AUD_SRCResampleReader(reader, m_specs.specs);
@@ -372,7 +378,7 @@
 		return NULL;
 
 	// play sound
-	AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound = new AUD_SoftwareDevice::AUD_SoftwareHandle(this, reader, keep);
+	AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound = new AUD_SoftwareDevice::AUD_SoftwareHandle(this, reader, pitch, keep);
 
 	lock();
 	m_playingSounds.push_back(sound);

Modified: branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.h
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.h	2011-06-21 20:29:02 UTC (rev 37714)
+++ branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.h	2011-06-21 20:32:25 UTC (rev 37715)
@@ -36,6 +36,7 @@
 #include "AUD_IHandle.h"
 #include "AUD_Mixer.h"
 #include "AUD_Buffer.h"
+#include "AUD_PitchReader.h"
 
 #include <list>
 #include <pthread.h>
@@ -58,6 +59,9 @@
 		/// The reader source.
 		AUD_Reference<AUD_IReader> m_reader;
 
+		/// The pitch reader in between.
+		AUD_Reference<AUD_PitchReader> m_pitch;
+
 		/// Whether to keep the source if end of it is reached.
 		bool m_keep;
 
@@ -81,7 +85,7 @@
 
 	public:
 
-		AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, bool keep);
+		AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_PitchReader> pitch, bool keep);
 
 		virtual ~AUD_SoftwareHandle() {}
 		virtual bool pause();




More information about the Bf-blender-cvs mailing list