force playing important sounds

see issue #144
This commit is contained in:
titiger
2017-02-02 02:54:29 +01:00
parent 9cc5a7566a
commit f3c436b67f
8 changed files with 17 additions and 11 deletions

View File

@@ -516,7 +516,7 @@ void SoundPlayerOpenAL::end() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
void SoundPlayerOpenAL::play(StaticSound* staticSound) {
void SoundPlayerOpenAL::play(StaticSound* staticSound, bool force ) {
assert(staticSound != 0);
if(initOk == false) return;
@@ -524,8 +524,14 @@ void SoundPlayerOpenAL::play(StaticSound* staticSound) {
try {
StaticSoundSource* source = findStaticSoundSource();
if(source == 0) {
return;
if(source == 0 ) {
if( force == false )
return;
else {
// force usage of first StaticSoundSource
source = staticSources.front();
source->stop();
}
}
source->play(staticSound);
}