[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34626] trunk/blender/intern/audaspace/ OpenAL/AUD_OpenALDevice.cpp: Audio Bugfixes:

Joerg Mueller nexyon at gmail.com
Thu Feb 3 14:25:07 CET 2011


Revision: 34626
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34626
Author:   nexyon
Date:     2011-02-03 13:25:05 +0000 (Thu, 03 Feb 2011)
Log Message:
-----------
Audio Bugfixes:

* [#25638] 'Insufficient thread locking' for sounds
  - Actually a workaround for an msvc bug, msvc STL containers are buggy
* [#25922] Sound does not play in BlenderPlayer(r34579)
  - Windows OpenAL doesn't seem to have clear context error state on initialising

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34579

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	2011-02-03 11:02:02 UTC (rev 34625)
+++ trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2011-02-03 13:25:05 UTC (rev 34626)
@@ -129,6 +129,9 @@
 	ALint info;
 	AUD_DeviceSpecs specs = m_specs;
 	ALCenum cerr;
+	std::list<AUD_OpenALHandle*> stopSounds;
+	std::list<AUD_OpenALHandle*> pauseSounds;
+	AUD_HandleIterator it;
 
 	while(1)
 	{
@@ -139,7 +142,7 @@
 		if(cerr == ALC_NO_ERROR)
 		{
 			// for all sounds
-			for(AUD_HandleIterator it = m_playingSounds->begin(); it != m_playingSounds->end(); it++)
+			for(it = m_playingSounds->begin(); it != m_playingSounds->end(); it++)
 			{
 				sound = *it;
 
@@ -234,21 +237,12 @@
 						if(sound->stop)
 							sound->stop(sound->stop_data);
 
-						// increment the iterator to the next value,
-						// because the sound gets deleted in the list here.
-						++it;
 						// pause or
 						if(sound->keep)
-							pause(sound);
+							pauseSounds.push_back(sound);
 						// stop
 						else
-							stop(sound);
-						// decrement again, so that we get the next sound in the
-						// next loop run
-						if(m_playingSounds->empty())
-							break;
-						else
-							--it;
+							stopSounds.push_back(sound);
 					}
 					// continue playing
 					else
@@ -256,6 +250,15 @@
 				}
 			}
 
+			for(it = pauseSounds.begin(); it != pauseSounds.end(); it++)
+				pause(*it);
+
+			for(it = stopSounds.begin(); it != stopSounds.end(); it++)
+				stop(*it);
+
+			pauseSounds.clear();
+			stopSounds.clear();
+
 			alcProcessContext(m_context);
 		}
 
@@ -340,6 +343,7 @@
 	m_useMC = alIsExtensionPresent("AL_EXT_MCFORMATS") == AL_TRUE;
 
 	alGetError();
+	alcGetError(m_device);
 
 	m_specs = specs;
 	m_buffersize = buffersize;




More information about the Bf-blender-cvs mailing list