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

Joerg Mueller nexyon at gmail.com
Sun Aug 7 13:54:58 CEST 2011


Revision: 39132
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39132
Author:   nexyon
Date:     2011-08-07 11:54:58 +0000 (Sun, 07 Aug 2011)
Log Message:
-----------
3D Audio GSoC:

* Pepper depends on ffmpeg 0.7.1 or higher now, windows and mac build systems set to ffmpeg-0.8
* Fixed orientation retrieval in OpenAL device code.
* Added stopAll() method to AUD_IDevice (also for Python) and call it on BGE exit
* Changed BGE to use audaspace via native C++ instead over the C API.
* Made AUD_SequencerFactory and AUD_SequencerEntry thread safe.
* Changed sound caching into a flag which fixes problems on file loading, especially with undo.
* Removed unused parameter from sound_mute_scene_sound
* Fixed bug: changing FPS didn't update the sequencer sound positions.
* Fixed bug: Properties of sequencer strips weren't set correctly.
* Minor warning fixes.

Modified Paths:
--------------
    branches/soc-2011-pepper/CMakeLists.txt
    branches/soc-2011-pepper/build_files/scons/config/darwin-config.py
    branches/soc-2011-pepper/build_files/scons/config/win32-mingw-config.py
    branches/soc-2011-pepper/build_files/scons/config/win32-vc-config.py
    branches/soc-2011-pepper/build_files/scons/config/win64-vc-config.py
    branches/soc-2011-pepper/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
    branches/soc-2011-pepper/intern/audaspace/OpenAL/AUD_OpenALDevice.h
    branches/soc-2011-pepper/intern/audaspace/Python/AUD_PyAPI.cpp
    branches/soc-2011-pepper/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
    branches/soc-2011-pepper/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_C-API.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_C-API.h
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_IDevice.h
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_IFactory.h
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_NULLDevice.h
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SequencerEntry.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SequencerEntry.h
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SequencerFactory.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SequencerFactory.h
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SequencerHandle.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SequencerReader.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.cpp
    branches/soc-2011-pepper/intern/audaspace/intern/AUD_SoftwareDevice.h
    branches/soc-2011-pepper/source/blender/blenkernel/BKE_sequencer.h
    branches/soc-2011-pepper/source/blender/blenkernel/BKE_sound.h
    branches/soc-2011-pepper/source/blender/blenkernel/intern/sequencer.c
    branches/soc-2011-pepper/source/blender/blenkernel/intern/sound.c
    branches/soc-2011-pepper/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-pepper/source/blender/editors/sound/sound_ops.c
    branches/soc-2011-pepper/source/blender/editors/space_sequencer/sequencer_add.c
    branches/soc-2011-pepper/source/blender/editors/space_sequencer/sequencer_edit.c
    branches/soc-2011-pepper/source/blender/makesdna/DNA_sound_types.h
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_scene.c
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_sequencer.c
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_sound.c
    branches/soc-2011-pepper/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
    branches/soc-2011-pepper/source/gameengine/Converter/KX_ConvertActuators.cpp
    branches/soc-2011-pepper/source/gameengine/Ketsji/CMakeLists.txt
    branches/soc-2011-pepper/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
    branches/soc-2011-pepper/source/gameengine/Ketsji/KX_SoundActuator.cpp
    branches/soc-2011-pepper/source/gameengine/Ketsji/KX_SoundActuator.h
    branches/soc-2011-pepper/source/gameengine/Ketsji/SConscript

Modified: branches/soc-2011-pepper/CMakeLists.txt
===================================================================
--- branches/soc-2011-pepper/CMakeLists.txt	2011-08-07 11:50:48 UTC (rev 39131)
+++ branches/soc-2011-pepper/CMakeLists.txt	2011-08-07 11:54:58 UTC (rev 39132)
@@ -687,15 +687,15 @@
 
 		if(WITH_CODEC_FFMPEG)
 			set(FFMPEG_INCLUDE_DIRS
-				${LIBDIR}/ffmpeg/include
-				${LIBDIR}/ffmpeg/include/msvc
+				${LIBDIR}/ffmpeg-0.8/include
+				${LIBDIR}/ffmpeg-0.8/include/msvc
 			)
 			set(FFMPEG_LIBRARIES
-				${LIBDIR}/ffmpeg/lib/avcodec-52.lib
-				${LIBDIR}/ffmpeg/lib/avformat-52.lib
-				${LIBDIR}/ffmpeg/lib/avdevice-52.lib
-				${LIBDIR}/ffmpeg/lib/avutil-50.lib
-				${LIBDIR}/ffmpeg/lib/swscale-0.lib
+				${LIBDIR}/ffmpeg-0.8/lib/avcodec-53.lib
+				${LIBDIR}/ffmpeg-0.8/lib/avformat-53.lib
+				${LIBDIR}/ffmpeg-0.8/lib/avdevice-53.lib
+				${LIBDIR}/ffmpeg-0.8/lib/avutil-51.lib
+				${LIBDIR}/ffmpeg-0.8/lib/swscale-2.lib
 			)
 		endif()
 
@@ -820,9 +820,9 @@
 		endif()
 		
 		if(WITH_CODEC_FFMPEG)
-			set(FFMPEG ${LIBDIR}/ffmpeg)
+			set(FFMPEG ${LIBDIR}/ffmpeg-0.8)
 			set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include ${FFMPEG}/include)
-			set(FFMPEG_LIBRARIES avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
+			set(FFMPEG_LIBRARIES avcodec-53 avformat-53 avdevice-53 avutil-51 swscale-2)
 			set(FFMPEG_LIBPATH ${FFMPEG}/lib)
 		endif()
 
@@ -959,7 +959,7 @@
 	endif()
 
 	if(WITH_CODEC_FFMPEG)
-		set(FFMPEG ${LIBDIR}/ffmpeg)
+		set(FFMPEG ${LIBDIR}/ffmpeg-0.8)
 		set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
 		set(FFMPEG_LIBRARIES avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg)
 		set(FFMPEG_LIBPATH ${FFMPEG}/lib)

Modified: branches/soc-2011-pepper/build_files/scons/config/darwin-config.py
===================================================================
--- branches/soc-2011-pepper/build_files/scons/config/darwin-config.py	2011-08-07 11:50:48 UTC (rev 39131)
+++ branches/soc-2011-pepper/build_files/scons/config/darwin-config.py	2011-08-07 11:54:58 UTC (rev 39132)
@@ -79,7 +79,7 @@
 
 # enable ffmpeg  support
 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
-BF_FFMPEG = LIBDIR + '/ffmpeg'
+BF_FFMPEG = LIBDIR + '/ffmpeg-0.8'
 BF_FFMPEG_INC = "${BF_FFMPEG}/include"
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
 BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'

Modified: branches/soc-2011-pepper/build_files/scons/config/win32-mingw-config.py
===================================================================
--- branches/soc-2011-pepper/build_files/scons/config/win32-mingw-config.py	2011-08-07 11:50:48 UTC (rev 39131)
+++ branches/soc-2011-pepper/build_files/scons/config/win32-mingw-config.py	2011-08-07 11:54:58 UTC (rev 39132)
@@ -18,9 +18,9 @@
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_FFMPEG = False
-BF_FFMPEG_LIB = 'avformat-52 avcodec-52 avdevice-52 avutil-50 swscale-0'
-BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
-BF_FFMPEG_INC =  LIBDIR + '/ffmpeg/include'
+BF_FFMPEG_LIB = 'avformat-53 avcodec-53 avdevice-53 avutil-51 swscale-2'
+BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg-0.8/lib'
+BF_FFMPEG_INC =  LIBDIR + '/ffmpeg-0.8/include'
 
 BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
 BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'

Modified: branches/soc-2011-pepper/build_files/scons/config/win32-vc-config.py
===================================================================
--- branches/soc-2011-pepper/build_files/scons/config/win32-vc-config.py	2011-08-07 11:50:48 UTC (rev 39131)
+++ branches/soc-2011-pepper/build_files/scons/config/win32-vc-config.py	2011-08-07 11:54:58 UTC (rev 39132)
@@ -3,11 +3,11 @@
 
 # enable ffmpeg  support
 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
-BF_FFMPEG = LIBDIR +'/ffmpeg'
+BF_FFMPEG = LIBDIR +'/ffmpeg-0.8'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
-BF_FFMPEG_LIB = 'avformat-52.lib avcodec-52.lib avdevice-52.lib avutil-50.lib swscale-0.lib'
-BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-52.dll ${BF_FFMPEG_LIBPATH}/avcodec-52.dll ${BF_FFMPEG_LIBPATH}/avdevice-52.dll ${BF_FFMPEG_LIBPATH}/avutil-50.dll ${BF_FFMPEG_LIBPATH}/swscale-0.dll'
+BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib swscale-2.lib'
+BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
 
 BF_PYTHON = LIBDIR + '/python'
 BF_PYTHON_VERSION = '3.2'

Modified: branches/soc-2011-pepper/build_files/scons/config/win64-vc-config.py
===================================================================
--- branches/soc-2011-pepper/build_files/scons/config/win64-vc-config.py	2011-08-07 11:50:48 UTC (rev 39131)
+++ branches/soc-2011-pepper/build_files/scons/config/win64-vc-config.py	2011-08-07 11:54:58 UTC (rev 39132)
@@ -3,11 +3,11 @@
 
 # enable ffmpeg  support
 WITH_BF_FFMPEG = True # -DWITH_FFMPEG
-BF_FFMPEG = LIBDIR +'/ffmpeg'
+BF_FFMPEG = LIBDIR +'/ffmpeg-0.8'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc '
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
-BF_FFMPEG_LIB = 'avformat-52.lib avcodec-52.lib avdevice-52.lib avutil-50.lib swscale-0.lib'
-BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-52.dll ${BF_FFMPEG_LIBPATH}/avcodec-52.dll ${BF_FFMPEG_LIBPATH}/avdevice-52.dll ${BF_FFMPEG_LIBPATH}/avutil-50.dll ${BF_FFMPEG_LIBPATH}/swscale-0.dll'
+BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib swscale-2.lib'
+BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
 
 BF_PYTHON = LIBDIR + '/python'
 BF_PYTHON_VERSION = '3.2'

Modified: branches/soc-2011-pepper/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2011-08-07 11:50:48 UTC (rev 39131)
+++ branches/soc-2011-pepper/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2011-08-07 11:54:58 UTC (rev 39132)
@@ -469,8 +469,7 @@
 
 AUD_Quaternion AUD_OpenALDevice::AUD_OpenALHandle::getSourceOrientation()
 {
-	// AUD_XXX not implemented yet
-	return AUD_Quaternion(0, 0, 0, 0);
+	return m_orientation;
 }
 
 bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceOrientation(const AUD_Quaternion& orientation)
@@ -491,6 +490,8 @@
 
 	m_device->unlock();
 
+	m_orientation = orientation;
+
 	return true;
 }
 
@@ -1284,6 +1285,21 @@
 	return play(factory->createReader(), keep);
 }
 
+void AUD_OpenALDevice::stopAll()
+{
+	lock();
+	alcSuspendContext(m_context);
+
+	while(!m_playingSounds.empty())
+		m_playingSounds.front()->stop();
+
+	while(!m_pausedSounds.empty())
+		m_pausedSounds.front()->stop();
+
+	alcProcessContext(m_context);
+	unlock();
+}
+
 void AUD_OpenALDevice::lock()
 {
 	pthread_mutex_lock(&m_mutex);
@@ -1454,8 +1470,7 @@
 
 AUD_Quaternion AUD_OpenALDevice::getListenerOrientation() const
 {
-	// AUD_XXX not implemented yet
-	return AUD_Quaternion(0, 0, 0, 0);
+	return m_orientation;
 }
 
 void AUD_OpenALDevice::setListenerOrientation(const AUD_Quaternion& orientation)
@@ -1474,6 +1489,7 @@
 	direction[5] = 2 * (orientation.w() * orientation.x() +
 						orientation.y() * orientation.z());
 	alListenerfv(AL_ORIENTATION, direction);
+	m_orientation = orientation;
 }
 
 float AUD_OpenALDevice::getSpeedOfSound() const

Modified: branches/soc-2011-pepper/intern/audaspace/OpenAL/AUD_OpenALDevice.h
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/OpenAL/AUD_OpenALDevice.h	2011-08-07 11:50:48 UTC (rev 39131)
+++ branches/soc-2011-pepper/intern/audaspace/OpenAL/AUD_OpenALDevice.h	2011-08-07 11:54:58 UTC (rev 39132)
@@ -89,6 +89,9 @@
 		/// Stop callback data.
 		void* m_stop_data;
 
+		/// Orientation.
+		AUD_Quaternion m_orientation;
+
 		/// Current status of the handle
 		AUD_Status m_status;
 
@@ -205,6 +208,11 @@
 	AUD_Buffer m_buffer;
 
 	/**
+	 * Orientation.
+	 */
+	AUD_Quaternion m_orientation;
+
+	/**
 	 * Starts the streaming thread.
 	 */
 	void start(bool join = true);
@@ -243,6 +251,7 @@
 	virtual AUD_DeviceSpecs getSpecs() const;
 	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IReader> reader, bool keep = false);
 	virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IFactory> factory, bool keep = false);
+	virtual void stopAll();
 	virtual void lock();
 	virtual void unlock();
 	virtual float getVolume() const;

Modified: branches/soc-2011-pepper/intern/audaspace/Python/AUD_PyAPI.cpp
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/Python/AUD_PyAPI.cpp	2011-08-07 11:50:48 UTC (rev 39131)
+++ branches/soc-2011-pepper/intern/audaspace/Python/AUD_PyAPI.cpp	2011-08-07 11:54:58 UTC (rev 39132)
@@ -2245,6 +2245,25 @@
 	return (PyObject *)handle;
 }
 
+PyDoc_STRVAR(M_aud_Device_stopAll_doc,
+			 "stopAll()\n\n"
+			 "Stops all playing and paused sounds.");
+
+static PyObject *
+Device_stopAll(Device *self)
+{
+	try
+	{
+		(*reinterpret_cast<AUD_Reference<AUD_IDevice>*>(self->device))->stopAll();
+		Py_RETURN_NONE;
+	}
+	catch(AUD_Exception& e)
+	{
+		PyErr_SetString(AUDError, e.str);
+		return NULL;
+	}
+}
+
 PyDoc_STRVAR(M_aud_Device_lock_doc,
 			 "lock()\n\n"
 			 "Locks the device so that it's guaranteed, that no samples are "
@@ -2295,6 +2314,9 @@
 	{"play", (PyCFunction)Device_play, METH_VARARGS | METH_KEYWORDS,
 	 M_aud_Device_play_doc
 	},
+	{"stopAll", (PyCFunction)Device_stopAll, METH_NOARGS,
+	 M_aud_Device_stopAll_doc
+	},
 	{"lock", (PyCFunction)Device_lock, METH_NOARGS,
 	 M_aud_Device_lock_doc
 	},

Modified: branches/soc-2011-pepper/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
===================================================================
--- branches/soc-2011-pepper/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp	2011-08-07 11:50:48 UTC (rev 39131)
+++ branches/soc-2011-pepper/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp	2011-08-07 11:54:58 UTC (rev 39132)
@@ -39,6 +39,7 @@
 extern "C" {
 #include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>
+#include <libavformat/avio.h>
 #include "ffmpeg_compat.h"
 }
 

Modified: branches/soc-2011-pepper/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list