Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-07-26 15:54:10 +0400
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-07-26 15:54:10 +0400
commit8a520165016f399002b03ec096be878a18aa3302 (patch)
tree7bfbfcf0693023854c9d932916f433ed9feebe6b /intern
parentf64c5cacf707d7a1ef36b45ea4f5569a732802f6 (diff)
Let the game engine manage it's own sound scene. This is to fix bug 1415 (Patch from Peter den Bak)
http://projects.blender.org/tracker/index.php?func=detail&aid=1415&group_id=9&atid=125 Also release the OpenAL device & context. These were leaked before, and would cause an assertion.
Diffstat (limited to 'intern')
-rw-r--r--intern/SoundSystem/intern/SND_DeviceManager.cpp3
-rw-r--r--intern/SoundSystem/openal/SND_OpenALDevice.cpp19
-rw-r--r--intern/SoundSystem/openal/SND_OpenALDevice.h1
3 files changed, 20 insertions, 3 deletions
diff --git a/intern/SoundSystem/intern/SND_DeviceManager.cpp b/intern/SoundSystem/intern/SND_DeviceManager.cpp
index d6f23ff5de4..37487686d71 100644
--- a/intern/SoundSystem/intern/SND_DeviceManager.cpp
+++ b/intern/SoundSystem/intern/SND_DeviceManager.cpp
@@ -78,6 +78,9 @@ void SND_DeviceManager::Unsubscribe()
delete m_instance;
m_instance = NULL;
}
+
+ if (m_subscriptions < 0)
+ m_subscriptions = 0;
}
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.cpp b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
index 9bdfeb73844..dfac8333a33 100644
--- a/intern/SoundSystem/openal/SND_OpenALDevice.cpp
+++ b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
@@ -205,6 +205,8 @@ ALvoid alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq)
SND_OpenALDevice::SND_OpenALDevice()
+ : m_context(NULL),
+ m_device(NULL)
{
/* Removed the functionality for checking if noaudio was provided on */
/* the commandline. */
@@ -229,6 +231,7 @@ SND_OpenALDevice::SND_OpenALDevice()
if (m_context) {
alcMakeContextCurrent(m_context);
m_audio = true;
+ m_device = dev;
}
}
@@ -302,13 +305,16 @@ void SND_OpenALDevice::MakeCurrent() const
SND_OpenALDevice::~SND_OpenALDevice()
{
if (m_context) {
- alcMakeContextCurrent(m_context);
-
+ MakeCurrent();
+
if (m_buffersinitialized)
alDeleteBuffers(NUM_BUFFERS, m_buffers);
if (m_sourcesinitialized)
alDeleteSources(NUM_SOURCES, m_sources);
+
+ alcDestroyContext(m_context);
+ m_context = NULL;
}
// let's see if we used the cd. if not, just leave it alone
@@ -323,6 +329,13 @@ SND_OpenALDevice::~SND_OpenALDevice()
if (m_cdrom)
delete m_cdrom;
#endif
+#ifdef OUDE_OPENAL
+ if (m_audio)
+ alutExit();
+#else
+ if (m_device)
+ alcCloseDevice((ALCdevice*) m_device);
+#endif
}
@@ -570,7 +583,7 @@ void SND_OpenALDevice::StopObject(int id) const
alSourcefv(m_sources[id], AL_POSITION, obpos);
alSourcefv(m_sources[id], AL_VELOCITY, obvel);
-
+
alSourcef(m_sources[id], AL_GAIN, 1.0);
alSourcef(m_sources[id], AL_PITCH, 1.0);
alSourcei(m_sources[id], AL_LOOPING, AL_FALSE);
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.h b/intern/SoundSystem/openal/SND_OpenALDevice.h
index 4f20580c2f3..4cd386cd48d 100644
--- a/intern/SoundSystem/openal/SND_OpenALDevice.h
+++ b/intern/SoundSystem/openal/SND_OpenALDevice.h
@@ -95,6 +95,7 @@ public:
private:
void* m_context;
+ void* m_device;
unsigned int m_buffers[NUM_BUFFERS];
unsigned int m_sources[NUM_SOURCES];