modified sound fade on app exit as per tom's forum post

This commit is contained in:
Mark Vejvoda 2011-11-11 18:15:46 +00:00
parent 0039354c15
commit 252080b3b0
3 changed files with 14 additions and 4 deletions

View File

@ -2537,7 +2537,7 @@ int glestMain(int argc, char** argv) {
ExceptionHandler exceptionHandler;
exceptionHandler.install( getCrashDumpFileName() );
int shutdownFadeSoundMilliseconds = 1750;
int shutdownFadeSoundMilliseconds = 1000;
Chrono chronoshutdownFadeSound;
SimpleTaskThread *soundThreadManager = NULL;
@ -3573,9 +3573,13 @@ int glestMain(int argc, char** argv) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(soundThreadManager) {
//printf("chronoshutdownFadeSound.getMillis() = %llu\n",chronoshutdownFadeSound.getMillis());
for(;chronoshutdownFadeSound.getMillis() <= shutdownFadeSoundMilliseconds;) {
sleep(10);
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
if( Config::getInstance().getString("FactorySound","") != "None" &&
soundRenderer.isVolumeTurnedOff() == false) {
//printf("chronoshutdownFadeSound.getMillis() = %llu\n",chronoshutdownFadeSound.getMillis());
for(;chronoshutdownFadeSound.getMillis() <= shutdownFadeSoundMilliseconds;) {
sleep(10);
}
}
BaseThread::shutdownAndWait(soundThreadManager);

View File

@ -251,6 +251,10 @@ void SoundRenderer::stopAllSounds(int64 fadeOff) {
}
}
bool SoundRenderer::isVolumeTurnedOff() const {
return (fxVolume <= 0 && musicVolume <= 0 && ambientVolume <= 0);
}
void SoundRenderer::loadConfig() {
Config &config= Config::getInstance();

View File

@ -83,6 +83,8 @@ public:
bool wasInitOk() const;
bool runningThreaded() const { return runThreadSafe; }
bool isVolumeTurnedOff() const;
};
}}//end namespace