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
This commit is contained in:
Joerg Mueller
2011-02-03 13:25:05 +00:00
parent 1e3ec65edc
commit 376e0ae2a3

View File

@@ -129,6 +129,9 @@ void AUD_OpenALDevice::updateStreams()
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 @@ void AUD_OpenALDevice::updateStreams()
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 @@ void AUD_OpenALDevice::updateStreams()
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 @@ void AUD_OpenALDevice::updateStreams()
}
}
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 @@ AUD_OpenALDevice::AUD_OpenALDevice(AUD_DeviceSpecs specs, int buffersize)
m_useMC = alIsExtensionPresent("AL_EXT_MCFORMATS") == AL_TRUE;
alGetError();
alcGetError(m_device);
m_specs = specs;
m_buffersize = buffersize;