mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 07:01:21 +02:00
- attempt to correct possible openal issues
This commit is contained in:
@@ -49,6 +49,9 @@ void SoundSource::unQueueBuffers() {
|
|||||||
|
|
||||||
ALint queued=0;
|
ALint queued=0;
|
||||||
alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
|
alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);
|
||||||
|
SoundPlayerOpenAL::checkAlError(string(__FILE__) + string(" ") + string(__FUNCTION__) + string(" ") + intToStr(__LINE__));
|
||||||
|
|
||||||
|
alSourcei(source, AL_LOOPING, AL_FALSE);
|
||||||
SoundPlayerOpenAL::checkAlError(string(__FILE__) + string(" ") + string(__FUNCTION__) + string(" ") + intToStr(__LINE__));
|
SoundPlayerOpenAL::checkAlError(string(__FILE__) + string(" ") + string(__FUNCTION__) + string(" ") + intToStr(__LINE__));
|
||||||
|
|
||||||
ALint processed=0;
|
ALint processed=0;
|
||||||
@@ -148,6 +151,7 @@ void StaticSoundSource::play(StaticSound* sound) {
|
|||||||
if(bufferAllocated) {
|
if(bufferAllocated) {
|
||||||
stop();
|
stop();
|
||||||
alDeleteBuffers(1, &buffer);
|
alDeleteBuffers(1, &buffer);
|
||||||
|
SoundPlayerOpenAL::checkAlError(string(__FILE__) + string(" ") + string(__FUNCTION__) + string(" ") + intToStr(__LINE__));
|
||||||
}
|
}
|
||||||
ALenum format = getFormat(sound);
|
ALenum format = getFormat(sound);
|
||||||
|
|
||||||
@@ -548,14 +552,20 @@ StaticSoundSource* SoundPlayerOpenAL::findStaticSoundSource() {
|
|||||||
if(initOk == false) return NULL;
|
if(initOk == false) return NULL;
|
||||||
|
|
||||||
// try to find a stopped source
|
// try to find a stopped source
|
||||||
|
int playingCount = 0;
|
||||||
for(StaticSoundSources::iterator i = staticSources.begin();
|
for(StaticSoundSources::iterator i = staticSources.begin();
|
||||||
i != staticSources.end(); ++i) {
|
i != staticSources.end(); ++i) {
|
||||||
StaticSoundSource* source = *i;
|
StaticSoundSource* source = *i;
|
||||||
if(! source->playing()) {
|
if(! source->playing()) {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
playingCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound,"In [%s::%s %d] playingCount = %d, staticSources.size() = %lu, params.staticBufferCount = %u\n",__FILE__,__FUNCTION__,__LINE__,playingCount,(unsigned long)staticSources.size(),params.staticBufferCount);
|
||||||
|
|
||||||
// create a new source
|
// create a new source
|
||||||
if(staticSources.size() >= params.staticBufferCount) {
|
if(staticSources.size() >= params.staticBufferCount) {
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user