[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26720] branches/soc-2008-mxcurioni: Merged changes in the trunk up to revision 26719.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Mon Feb 8 22:13:33 CET 2010


Revision: 26720
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26720
Author:   kjym3
Date:     2010-02-08 22:13:33 +0100 (Mon, 08 Feb 2010)

Log Message:
-----------
Merged changes in the trunk up to revision 26719.

Revision Links:
--------------
    http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26719

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_FaderReader.cpp
    branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_LoopReader.cpp
    branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_LoopReader.h
    branches/soc-2008-mxcurioni/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
    branches/soc-2008-mxcurioni/intern/audaspace/SRC/AUD_SRCResampleReader.cpp
    branches/soc-2008-mxcurioni/intern/audaspace/SRC/AUD_SRCResampleReader.h
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_C-API.cpp
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_C-API.h
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_Mixer.cpp
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_Mixer.h
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_SoftwareDevice.cpp
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_Space.h
    branches/soc-2008-mxcurioni/intern/audaspace/make/msvc_9_0/audaspace.vcproj
    branches/soc-2008-mxcurioni/intern/guardedalloc/MEM_guardedalloc.h
    branches/soc-2008-mxcurioni/intern/guardedalloc/intern/mallocn.c
    branches/soc-2008-mxcurioni/intern/opennl/superlu/get_perm_c.c
    branches/soc-2008-mxcurioni/intern/smoke/intern/FLUID_3D.cpp
    branches/soc-2008-mxcurioni/intern/smoke/intern/FLUID_3D_STATIC.cpp
    branches/soc-2008-mxcurioni/intern/smoke/intern/WAVELET_NOISE.h
    branches/soc-2008-mxcurioni/projectfiles_vc9/gameengine/ketsji/KX_ketsji.vcproj
    branches/soc-2008-mxcurioni/release/scripts/op/presets.py
    branches/soc-2008-mxcurioni/release/scripts/ui/properties_data_lamp.py
    branches/soc-2008-mxcurioni/release/scripts/ui/properties_material.py
    branches/soc-2008-mxcurioni/release/scripts/ui/properties_render.py
    branches/soc-2008-mxcurioni/release/scripts/ui/properties_texture.py
    branches/soc-2008-mxcurioni/release/scripts/ui/space_dopesheet.py
    branches/soc-2008-mxcurioni/release/scripts/ui/space_graph.py
    branches/soc-2008-mxcurioni/release/scripts/ui/space_sequencer.py
    branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_fcurve.h
    branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_screen.h
    branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_sequencer.h
    branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_sound.h
    branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_writeffmpeg.h
    branches/soc-2008-mxcurioni/source/blender/blenkernel/CMakeLists.txt
    branches/soc-2008-mxcurioni/source/blender/blenkernel/SConscript
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/CCGSubSurf.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/Makefile
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/collision.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/constraint.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/exotic.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/multires.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/node.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/pointcache.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/scene.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/screen.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/sequencer.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/softbody.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/sound.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/subsurf_ccg.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/texture.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/writeffmpeg.c
    branches/soc-2008-mxcurioni/source/blender/blenlib/intern/BLI_args.c
    branches/soc-2008-mxcurioni/source/blender/blenlib/intern/BLI_kdopbvh.c
    branches/soc-2008-mxcurioni/source/blender/blenlib/intern/bpath.c
    branches/soc-2008-mxcurioni/source/blender/blenlib/intern/noise.c
    branches/soc-2008-mxcurioni/source/blender/blenlib/intern/path_util.c
    branches/soc-2008-mxcurioni/source/blender/blenlib/intern/storage.c
    branches/soc-2008-mxcurioni/source/blender/blenloader/intern/readfile.c
    branches/soc-2008-mxcurioni/source/blender/editors/animation/anim_channels_defines.c
    branches/soc-2008-mxcurioni/source/blender/editors/animation/anim_channels_edit.c
    branches/soc-2008-mxcurioni/source/blender/editors/animation/anim_markers.c
    branches/soc-2008-mxcurioni/source/blender/editors/animation/anim_ops.c
    branches/soc-2008-mxcurioni/source/blender/editors/animation/keyframes_edit.c
    branches/soc-2008-mxcurioni/source/blender/editors/armature/editarmature.c
    branches/soc-2008-mxcurioni/source/blender/editors/armature/editarmature_sketch.c
    branches/soc-2008-mxcurioni/source/blender/editors/armature/poseobject.c
    branches/soc-2008-mxcurioni/source/blender/editors/interface/interface.c
    branches/soc-2008-mxcurioni/source/blender/editors/interface/interface_handlers.c
    branches/soc-2008-mxcurioni/source/blender/editors/interface/interface_icons.c
    branches/soc-2008-mxcurioni/source/blender/editors/mesh/meshtools.c
    branches/soc-2008-mxcurioni/source/blender/editors/object/object_transform.c
    branches/soc-2008-mxcurioni/source/blender/editors/physics/physics_fluid.c
    branches/soc-2008-mxcurioni/source/blender/editors/screen/area.c
    branches/soc-2008-mxcurioni/source/blender/editors/screen/screen_ops.c
    branches/soc-2008-mxcurioni/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2008-mxcurioni/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2008-mxcurioni/source/blender/editors/sound/sound_ops.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_action/action_edit.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_action/action_select.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_file/filelist.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_graph/graph_edit.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_graph/graph_ops.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_graph/graph_select.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_nla/nla_channels.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_sequencer/sequencer_add.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_sequencer/sequencer_draw.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_sequencer/sequencer_edit.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_sequencer/sequencer_intern.h
    branches/soc-2008-mxcurioni/source/blender/editors/space_sequencer/space_sequencer.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_text/text_draw.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_text/text_intern.h
    branches/soc-2008-mxcurioni/source/blender/editors/space_text/text_ops.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_view3d/view3d_draw.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_view3d/view3d_select.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_view3d/view3d_view.c
    branches/soc-2008-mxcurioni/source/blender/editors/transform/transform_conversions.c
    branches/soc-2008-mxcurioni/source/blender/editors/uvedit/uvedit_parametrizer.c
    branches/soc-2008-mxcurioni/source/blender/imbuf/intern/iff.c
    branches/soc-2008-mxcurioni/source/blender/imbuf/intern/thumbs.c
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_sequence_types.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_sound_types.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_space_types.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_text_types.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/RNA_access.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/makesrna.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_ID.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_access.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_actuator.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_color.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_lamp.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_material.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_scene.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_sequencer.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_ui.c
    branches/soc-2008-mxcurioni/source/blender/nodes/intern/TEX_nodes/TEX_output.c
    branches/soc-2008-mxcurioni/source/blender/nodes/intern/TEX_util.c
    branches/soc-2008-mxcurioni/source/blender/python/intern/bpy_interface.c
    branches/soc-2008-mxcurioni/source/blender/render/intern/include/shading.h
    branches/soc-2008-mxcurioni/source/blender/render/intern/raytrace/rayobject.cpp
    branches/soc-2008-mxcurioni/source/blender/render/intern/source/pipeline.c
    branches/soc-2008-mxcurioni/source/blender/render/intern/source/rendercore.c
    branches/soc-2008-mxcurioni/source/blender/render/intern/source/shadeoutput.c
    branches/soc-2008-mxcurioni/source/blender/render/intern/source/voxeldata.c
    branches/soc-2008-mxcurioni/source/blender/windowmanager/WM_types.h
    branches/soc-2008-mxcurioni/source/blender/windowmanager/intern/wm_event_system.c
    branches/soc-2008-mxcurioni/source/blender/windowmanager/intern/wm_keymap.c
    branches/soc-2008-mxcurioni/source/blenderplayer/bad_level_call_stubs/stubs.c
    branches/soc-2008-mxcurioni/source/creator/creator.c
    branches/soc-2008-mxcurioni/source/gameengine/Converter/KX_ConvertActuators.cpp
    branches/soc-2008-mxcurioni/source/gameengine/Ketsji/CMakeLists.txt
    branches/soc-2008-mxcurioni/source/gameengine/Ketsji/KX_SoundActuator.cpp
    branches/soc-2008-mxcurioni/source/gameengine/Ketsji/SConscript
    branches/soc-2008-mxcurioni/source/gameengine/PyDoc/VideoTexture.py
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/ImageBase.cpp
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/ImageBase.h
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/ImageMix.cpp
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/ImageMix.h
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/ImageRender.cpp
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/ImageRender.h
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/ImageViewport.cpp
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/ImageViewport.h
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/SConscript
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/Texture.cpp
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/VideoFFmpeg.cpp
    branches/soc-2008-mxcurioni/source/gameengine/VideoTexture/VideoFFmpeg.h

Added Paths:
-----------
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_SequencerFactory.cpp
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_SequencerFactory.h
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_SequencerReader.cpp
    branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_SequencerReader.h
    branches/soc-2008-mxcurioni/release/scripts/op/sequencer.py
    branches/soc-2008-mxcurioni/release/scripts/presets/sunsky/
    branches/soc-2008-mxcurioni/release/scripts/presets/sunsky/classic.py
    branches/soc-2008-mxcurioni/release/scripts/presets/sunsky/desert.py
    branches/soc-2008-mxcurioni/release/scripts/presets/sunsky/mountain.py

Removed Paths:
-------------
    branches/soc-2008-mxcurioni/release/scripts/presets/sunsky/classic.py
    branches/soc-2008-mxcurioni/release/scripts/presets/sunsky/desert.py
    branches/soc-2008-mxcurioni/release/scripts/presets/sunsky/mountain.py

Modified: branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_FaderReader.cpp
===================================================================
--- branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_FaderReader.cpp	2010-02-08 20:14:44 UTC (rev 26719)
+++ branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_FaderReader.cpp	2010-02-08 21:13:33 UTC (rev 26720)
@@ -78,7 +78,7 @@
 	else
 	{
 		sample_t* buf = m_buffer->getBuffer();
-		float volume;
+		float volume = 1.0f;
 
 		for(int i = 0; i < length * specs.channels; i++)
 		{

Modified: branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_LoopReader.cpp
===================================================================
--- branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_LoopReader.cpp	2010-02-08 20:14:44 UTC (rev 26719)
+++ branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_LoopReader.cpp	2010-02-08 21:13:33 UTC (rev 26720)
@@ -31,6 +31,7 @@
 AUD_LoopReader::AUD_LoopReader(AUD_IReader* reader, int loop) :
 		AUD_EffectReader(reader), m_loop(loop)
 {
+	m_samples = -1;
 	m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
 }
 
@@ -51,6 +52,7 @@
 	if(message.type == AUD_MSG_LOOP)
 	{
 		m_loop = message.loopcount;
+		m_samples = message.time * m_reader->getSpecs().rate;
 
 		m_reader->notify(message);
 
@@ -64,6 +66,13 @@
 	AUD_Specs specs = m_reader->getSpecs();
 	int samplesize = AUD_SAMPLE_SIZE(specs);
 
+	if(m_samples >= 0)
+	{
+		if(length > m_samples)
+			length = m_samples;
+		m_samples -= length;
+	}
+
 	int len = length;
 
 	m_reader->read(len, buffer);

Modified: branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_LoopReader.h
===================================================================
--- branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_LoopReader.h	2010-02-08 20:14:44 UTC (rev 26719)
+++ branches/soc-2008-mxcurioni/intern/audaspace/FX/AUD_LoopReader.h	2010-02-08 21:13:33 UTC (rev 26720)
@@ -46,6 +46,11 @@
 	 */
 	int m_loop;
 
+	/**
+	 * The left samples.
+	 */
+	int m_samples;
+
 public:
 	/**
 	 * Creates a new loop reader.

Modified: branches/soc-2008-mxcurioni/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
===================================================================
--- branches/soc-2008-mxcurioni/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2010-02-08 20:14:44 UTC (rev 26719)
+++ branches/soc-2008-mxcurioni/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2010-02-08 21:13:33 UTC (rev 26720)
@@ -180,7 +180,7 @@
 											 AUD_DEVICE_SAMPLE_SIZE(specs),
 											 specs.rate);
 
-								if(alGetError() != AL_NO_ERROR)
+								if((err = alGetError()) != AL_NO_ERROR)
 								{
 									sound->data_end = true;
 									break;
@@ -839,13 +839,14 @@
 
 			if(info != AL_PLAYING)
 			{
-				if(info != AL_STOPPED)
+				if(info == AL_PAUSED)
 					alSourceStop(alhandle->source);
 
-				alSourceUnqueueBuffers(alhandle->source,
-									   AUD_OPENAL_CYCLE_BUFFERS,
-									   alhandle->buffers);
-				if(alGetError() == AL_NO_ERROR)
+				alSourcei(alhandle->source, AL_BUFFER, 0);
+				alhandle->current = 0;
+
+				ALenum err;
+				if((err = alGetError()) == AL_NO_ERROR)
 				{
 					sample_t* buf;
 					int length;
@@ -889,11 +890,14 @@
 	if(isValid(handle))
 	{
 		AUD_OpenALHandle* h = (AUD_OpenALHandle*)handle;
-		if(h->isBuffered)
-			alGetSourcef(h->source, AL_SEC_OFFSET, &position);
-		else
-			position = h->reader->getPosition() /
-					   (float)h->reader->getSpecs().rate;
+		alGetSourcef(h->source, AL_SEC_OFFSET, &position);
+		if(!h->isBuffered)
+		{
+			AUD_Specs specs = h->reader->getSpecs();
+			position += (h->reader->getPosition() - m_buffersize *
+									AUD_OPENAL_CYCLE_BUFFERS / specs.channels) /
+					   (float)specs.rate;
+		}
 	}
 
 	unlock();

Modified: branches/soc-2008-mxcurioni/intern/audaspace/SRC/AUD_SRCResampleReader.cpp
===================================================================
--- branches/soc-2008-mxcurioni/intern/audaspace/SRC/AUD_SRCResampleReader.cpp	2010-02-08 20:14:44 UTC (rev 26719)
+++ branches/soc-2008-mxcurioni/intern/audaspace/SRC/AUD_SRCResampleReader.cpp	2010-02-08 21:13:33 UTC (rev 26720)
@@ -44,6 +44,7 @@
 	m_tspecs = specs;
 	m_tspecs.channels = m_sspecs.channels;
 	m_factor = (double)m_tspecs.rate / (double)m_sspecs.rate;
+	m_position = 0;
 
 	int error;
 	m_src = src_callback_new(src_callback,
@@ -71,7 +72,7 @@
 
 long AUD_SRCResampleReader::doCallback(float** data)
 {
-	int length = m_buffer->getSize() / 4 / m_tspecs.channels;
+	int length = m_buffer->getSize() / AUD_SAMPLE_SIZE(m_tspecs);
 	sample_t* buffer;
 
 	m_reader->read(length, buffer);
@@ -84,6 +85,7 @@
 {
 	m_reader->seek(position / m_factor);
 	src_reset(m_src);
+	m_position = position;
 }
 
 int AUD_SRCResampleReader::getLength()
@@ -93,7 +95,7 @@
 
 int AUD_SRCResampleReader::getPosition()
 {
-	return m_reader->getPosition() * m_factor;
+	return m_position;
 }
 
 AUD_Specs AUD_SRCResampleReader::getSpecs()
@@ -111,4 +113,6 @@
 	buffer = m_buffer->getBuffer();
 
 	length = src_callback_read(m_src, m_factor, length, buffer);
+
+	m_position += length;
 }

Modified: branches/soc-2008-mxcurioni/intern/audaspace/SRC/AUD_SRCResampleReader.h
===================================================================
--- branches/soc-2008-mxcurioni/intern/audaspace/SRC/AUD_SRCResampleReader.h	2010-02-08 20:14:44 UTC (rev 26719)
+++ branches/soc-2008-mxcurioni/intern/audaspace/SRC/AUD_SRCResampleReader.h	2010-02-08 21:13:33 UTC (rev 26720)
@@ -62,6 +62,11 @@
 	 */
 	SRC_STATE* m_src;
 
+	/**
+	 * The current playback position;
+	 */
+	int m_position;
+
 public:
 	/**
 	 * Creates a resampling reader.

Modified: branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_C-API.cpp
===================================================================
--- branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_C-API.cpp	2010-02-08 20:14:44 UTC (rev 26719)
+++ branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_C-API.cpp	2010-02-08 21:13:33 UTC (rev 26720)
@@ -25,6 +25,7 @@
 
 #include <cstdlib>
 #include <cstring>
+#include <cmath>
 
 #include "AUD_NULLDevice.h"
 #include "AUD_I3DDevice.h"
@@ -47,6 +48,7 @@
 #include "AUD_ReadDevice.h"
 #include "AUD_SourceCaps.h"
 #include "AUD_IReader.h"
+#include "AUD_SequencerFactory.h"
 
 #ifdef WITH_SDL
 #include "AUD_SDLDevice.h"
@@ -231,7 +233,7 @@
 	}
 }
 
-extern AUD_Sound* AUD_limitSound(AUD_Sound* sound, float start, float end)
+AUD_Sound* AUD_limitSound(AUD_Sound* sound, float start, float end)
 {
 	assert(sound);
 
@@ -273,13 +275,14 @@
 	}
 }
 
-int AUD_stopLoop(AUD_Handle* handle)
+int AUD_setLoop(AUD_Handle* handle, int loops, float time)
 {
 	if(handle)
 	{
 		AUD_Message message;
 		message.type = AUD_MSG_LOOP;
-		message.loopcount = 0;
+		message.loopcount = loops;
+		message.time = time;
 
 		try
 		{
@@ -537,14 +540,16 @@
 	}
 }
 
-AUD_Handle* AUD_playDevice(AUD_Device* device, AUD_Sound* sound)
+AUD_Handle* AUD_playDevice(AUD_Device* device, AUD_Sound* sound, float seek)
 {
 	assert(device);
 	assert(sound);
 
 	try
 	{
-		return device->play(sound);
+		AUD_Handle* handle = device->play(sound);
+		device->seek(handle, seek);
+		return handle;
 	}
 	catch(AUD_Exception)
 	{
@@ -663,3 +668,108 @@
 	*length = position;
 	return result;
 }
+
+AUD_Sound* AUD_createSequencer(void* data, AUD_volumeFunction volume)
+{
+/* AUD_XXX should be this: but AUD_createSequencer is called before the device
+ * is initialized.
+
+	return new AUD_SequencerFactory(AUD_device->getSpecs().specs, data, volume);
+*/
+	AUD_Specs specs;
+	specs.channels = AUD_CHANNELS_STEREO;
+	specs.rate = AUD_RATE_44100;
+	return new AUD_SequencerFactory(specs, data, volume);
+}
+
+void AUD_destroySequencer(AUD_Sound* sequencer)
+{
+	delete ((AUD_SequencerFactory*)sequencer);
+}
+
+AUD_SequencerEntry* AUD_addSequencer(AUD_Sound** sequencer, AUD_Sound* sound,
+								 float begin, float end, float skip, void* data)
+{
+	return ((AUD_SequencerFactory*)sequencer)->add((AUD_IFactory**) sound, begin, end, skip, data);
+}
+
+void AUD_removeSequencer(AUD_Sound* sequencer, AUD_SequencerEntry* entry)
+{
+	((AUD_SequencerFactory*)sequencer)->remove(entry);
+}
+
+void AUD_moveSequencer(AUD_Sound* sequencer, AUD_SequencerEntry* entry,
+				   float begin, float end, float skip)
+{
+	((AUD_SequencerFactory*)sequencer)->move(entry, begin, end, skip);
+}
+
+void AUD_muteSequencer(AUD_Sound* sequencer, AUD_SequencerEntry* entry, char mute)
+{
+	((AUD_SequencerFactory*)sequencer)->mute(entry, mute);
+}
+
+int AUD_readSound(AUD_Sound* sound, sample_t* buffer, int length)
+{
+	AUD_IReader* reader = sound->createReader();
+	AUD_DeviceSpecs specs;
+	sample_t* buf;
+
+	specs.specs = reader->getSpecs();
+	specs.channels = AUD_CHANNELS_MONO;
+	specs.format = AUD_FORMAT_FLOAT32;
+
+	AUD_ChannelMapperFactory mapper(reader, specs);
+
+	if(!reader || reader->getType() != AUD_TYPE_BUFFER)
+		return -1;
+
+	reader = mapper.createReader();
+
+	if(!reader)
+		return -1;
+
+	int len = reader->getLength();
+	float samplejump = (float)len / (float)length;
+	float min, max;
+
+	for(int i = 0; i < length; i++)
+	{
+		len = floor(samplejump * (i+1)) - floor(samplejump * i);
+		reader->read(len, buf);
+
+		if(len < 1)
+		{
+			length = i;
+			break;
+		}
+
+		max = min = *buf;
+		for(int j = 1; j < len; j++)
+		{
+			if(buf[j] < min)
+				min = buf[j];
+			if(buf[j] > max)
+				max = buf[j];
+			buffer[i * 2] = min;
+			buffer[i * 2 + 1] = max;
+		}
+	}
+
+	delete reader; AUD_DELETE("reader")
+
+	return length;
+}
+
+#ifdef AUD_DEBUG_MEMORY
+int AUD_References(int count, const char* text)
+{
+	static int m_count = 0;
+	m_count += count;
+	if(count > 0)
+		printf("+%s\n", text);
+	if(count < 0)
+		printf("-%s\n", text);
+	return m_count;
+}
+#endif

Modified: branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_C-API.h
===================================================================
--- branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_C-API.h	2010-02-08 20:14:44 UTC (rev 26719)
+++ branches/soc-2008-mxcurioni/intern/audaspace/intern/AUD_C-API.h	2010-02-08 21:13:33 UTC (rev 26720)
@@ -50,6 +50,8 @@
 	typedef void AUD_Sound;
 	typedef void AUD_Handle;
 	typedef void AUD_Device;
+	typedef void AUD_SequencerEntry;
+	typedef float (*AUD_volumeFunction)(void*, void*, float);
 #endif
 
 /**
@@ -143,11 +145,13 @@
 extern AUD_Sound* AUD_loopSound(AUD_Sound* sound);
 
 /**
- * Stops a looping sound when the current playback finishes.
+ * Sets a remaining loop count of a looping sound that currently plays.
  * \param handle The playback handle.
+ * \param loops The count of remaining loops, -1 for infinity.

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list