diff options
Diffstat (limited to 'intern/SoundSystem/openal/SND_OpenALDevice.cpp')
-rw-r--r-- | intern/SoundSystem/openal/SND_OpenALDevice.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.cpp b/intern/SoundSystem/openal/SND_OpenALDevice.cpp index ebcd0e4aea4..c660e9aecba 100644 --- a/intern/SoundSystem/openal/SND_OpenALDevice.cpp +++ b/intern/SoundSystem/openal/SND_OpenALDevice.cpp @@ -294,6 +294,10 @@ SND_OpenALDevice::SND_OpenALDevice() // let openal generate its sources if (alc_error == ALC_NO_ERROR) { + int i; + + for (i=0;i<NUM_SOURCES;i++) + m_sources[i] = 0; alGenSources(NUM_SOURCES, m_sources); m_sourcesinitialized = true; } @@ -329,12 +333,6 @@ SND_OpenALDevice::~SND_OpenALDevice() { MakeCurrent(); - if (m_buffersinitialized) - { - alDeleteBuffers(NUM_BUFFERS, m_buffers); - m_buffersinitialized = false; - } - if (m_sourcesinitialized) { for (int i = 0; i < NUM_SOURCES; i++) @@ -344,6 +342,12 @@ SND_OpenALDevice::~SND_OpenALDevice() m_sourcesinitialized = false; } + if (m_buffersinitialized) + { + alDeleteBuffers(NUM_BUFFERS, m_buffers); + m_buffersinitialized = false; + } + if (m_context) { MakeCurrent(); #ifdef AL_VERSION_1_1 |