[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61196] trunk/blender/intern/audaspace/ OpenAL/AUD_OpenALDevice.cpp: Fix for [#37293] Audio does not Scrub, plays fully instead

Joerg Mueller nexyon at gmail.com
Fri Nov 8 00:40:07 CET 2013


Revision: 61196
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61196
Author:   nexyon
Date:     2013-11-07 23:40:06 +0000 (Thu, 07 Nov 2013)
Log Message:
-----------
Fix for [#37293] Audio does not Scrub, plays fully instead

Modified Paths:
--------------
    trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp

Modified: trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
===================================================================
--- trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2013-11-07 15:25:11 UTC (rev 61195)
+++ trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2013-11-07 23:40:06 UTC (rev 61196)
@@ -119,6 +119,14 @@
 		{
 			length = m_device->m_buffersize;
 			reader->read(length, eos, m_device->m_buffer.getBuffer());
+
+			if(length == 0)
+			{
+				// AUD_XXX: TODO: don't fill all buffers and enqueue them later
+				length = 1;
+				memset(m_device->m_buffer.getBuffer(), 0, length * AUD_DEVICE_SAMPLE_SIZE(specs));
+			}
+
 			alBufferData(m_buffers[i], m_format, m_device->m_buffer.getBuffer(),
 						 length * AUD_DEVICE_SAMPLE_SIZE(specs),
 						 specs.rate);
@@ -132,8 +140,7 @@
 
 		try
 		{
-			alSourceQueueBuffers(m_source, CYCLE_BUFFERS,
-								 m_buffers);
+			alSourceQueueBuffers(m_source, CYCLE_BUFFERS, m_buffers);
 			if(alGetError() != AL_NO_ERROR)
 				AUD_THROW(AUD_ERROR_OPENAL, queue_error);
 		}
@@ -289,6 +296,14 @@
 				{
 					length = m_device->m_buffersize;
 					m_reader->read(length, m_eos, m_device->m_buffer.getBuffer());
+
+					if(length == 0)
+					{
+						// AUD_XXX: TODO: don't fill all buffers and enqueue them later
+						length = 1;
+						memset(m_device->m_buffer.getBuffer(), 0, length * AUD_DEVICE_SAMPLE_SIZE(specs));
+					}
+
 					alBufferData(m_buffers[i], m_format, m_device->m_buffer.getBuffer(),
 								 length * AUD_DEVICE_SAMPLE_SIZE(specs), specs.rate);
 
@@ -933,9 +948,8 @@
 									break;
 								}
 
-								// unqueue buffer
-								alSourceUnqueueBuffers(sound->m_source, 1,
-												&sound->m_buffers[sound->m_current]);
+								// unqueue buffer (warning: this might fail for slow early returning sources (none exist so far) if the buffer was not queued due to recent changes - has to be tested)
+								alSourceUnqueueBuffers(sound->m_source, 1, &sound->m_buffers[sound->m_current]);
 								ALenum err;
 								if((err = alGetError()) != AL_NO_ERROR)
 								{




More information about the Bf-blender-cvs mailing list