[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51831] trunk/blender/intern/audaspace: Preparation to use boost::shared_ptr.

Joerg Mueller nexyon at gmail.com
Sat Nov 3 10:49:55 CET 2012


Revision: 51831
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51831
Author:   nexyon
Date:     2012-11-03 09:49:49 +0000 (Sat, 03 Nov 2012)
Log Message:
-----------
Preparation to use boost::shared_ptr.

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

Modified: trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
===================================================================
--- trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2012-11-03 09:14:06 UTC (rev 51830)
+++ trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2012-11-03 09:49:49 UTC (rev 51831)
@@ -174,21 +174,34 @@
 	if(!m_status)
 		return false;
 
-	// AUD_XXX Create a reference of our own object so that it doesn't get
-	// deleted before the end of this function
-	AUD_Reference<AUD_OpenALHandle> This = this;
+	m_status = AUD_STATUS_INVALID;
 
-	if(m_status == AUD_STATUS_PLAYING)
-		m_device->m_playingSounds.remove(This);
-	else
-		m_device->m_pausedSounds.remove(This);
-
 	alDeleteSources(1, &m_source);
 	if(!m_isBuffered)
 		alDeleteBuffers(CYCLE_BUFFERS, m_buffers);
 
-	m_status = AUD_STATUS_INVALID;
-	return true;
+	for(AUD_HandleIterator it = m_device->m_playingSounds.begin(); it != m_device->m_playingSounds.end(); it++)
+	{
+		if(it->get() == this)
+		{
+			AUD_Reference<AUD_OpenALHandle> This = *it;
+
+			m_device->m_playingSounds.erase(it);
+
+			return true;
+		}
+	}
+
+	for(AUD_HandleIterator it = m_device->m_pausedSounds.begin(); it != m_device->m_pausedSounds.end(); it++)
+	{
+		if(it->get() == this)
+		{
+			m_device->m_pausedSounds.erase(it);
+			return true;
+		}
+	}
+
+	return false;
 }
 
 bool AUD_OpenALDevice::AUD_OpenALHandle::getKeep()

Modified: trunk/blender/intern/audaspace/intern/AUD_SoftwareDevice.cpp
===================================================================
--- trunk/blender/intern/audaspace/intern/AUD_SoftwareDevice.cpp	2012-11-03 09:14:06 UTC (rev 51830)
+++ trunk/blender/intern/audaspace/intern/AUD_SoftwareDevice.cpp	2012-11-03 09:49:49 UTC (rev 51831)
@@ -277,22 +277,33 @@
 	if(!m_status)
 		return false;
 
-	// AUD_XXX Create a reference of our own object so that it doesn't get
-	// deleted before the end of this function
-	AUD_Reference<AUD_SoftwareHandle> This = this;
+	m_status = AUD_STATUS_INVALID;
 
-	if(m_status == AUD_STATUS_PLAYING)
+	for(AUD_HandleIterator it = m_device->m_playingSounds.begin(); it != m_device->m_playingSounds.end(); it++)
 	{
-		m_device->m_playingSounds.remove(This);
+		if(it->get() == this)
+		{
+			AUD_Reference<AUD_SoftwareHandle> This = *it;
 
-		if(m_device->m_playingSounds.empty())
-			m_device->playing(m_device->m_playback = false);
+			m_device->m_playingSounds.erase(it);
+
+			if(m_device->m_playingSounds.empty())
+				m_device->playing(m_device->m_playback = false);
+
+			return true;
+		}
 	}
-	else
-		m_device->m_pausedSounds.remove(This);
 
-	m_status = AUD_STATUS_INVALID;
-	return true;
+	for(AUD_HandleIterator it = m_device->m_pausedSounds.begin(); it != m_device->m_pausedSounds.end(); it++)
+	{
+		if(it->get() == this)
+		{
+			m_device->m_pausedSounds.erase(it);
+			return true;
+		}
+	}
+
+	return false;
 }
 
 bool AUD_SoftwareDevice::AUD_SoftwareHandle::getKeep()




More information about the Bf-blender-cvs mailing list