mirror of
https://github.com/glest/glest-source.git
synced 2025-09-09 23:40:45 +02:00
modified sound fade on app exit as per tom's forum post
This commit is contained in:
@@ -2537,7 +2537,7 @@ int glestMain(int argc, char** argv) {
|
|||||||
ExceptionHandler exceptionHandler;
|
ExceptionHandler exceptionHandler;
|
||||||
exceptionHandler.install( getCrashDumpFileName() );
|
exceptionHandler.install( getCrashDumpFileName() );
|
||||||
|
|
||||||
int shutdownFadeSoundMilliseconds = 1750;
|
int shutdownFadeSoundMilliseconds = 1000;
|
||||||
Chrono chronoshutdownFadeSound;
|
Chrono chronoshutdownFadeSound;
|
||||||
SimpleTaskThread *soundThreadManager = NULL;
|
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__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(soundThreadManager) {
|
if(soundThreadManager) {
|
||||||
//printf("chronoshutdownFadeSound.getMillis() = %llu\n",chronoshutdownFadeSound.getMillis());
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
for(;chronoshutdownFadeSound.getMillis() <= shutdownFadeSoundMilliseconds;) {
|
if( Config::getInstance().getString("FactorySound","") != "None" &&
|
||||||
sleep(10);
|
soundRenderer.isVolumeTurnedOff() == false) {
|
||||||
|
//printf("chronoshutdownFadeSound.getMillis() = %llu\n",chronoshutdownFadeSound.getMillis());
|
||||||
|
for(;chronoshutdownFadeSound.getMillis() <= shutdownFadeSoundMilliseconds;) {
|
||||||
|
sleep(10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseThread::shutdownAndWait(soundThreadManager);
|
BaseThread::shutdownAndWait(soundThreadManager);
|
||||||
|
@@ -251,6 +251,10 @@ void SoundRenderer::stopAllSounds(int64 fadeOff) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SoundRenderer::isVolumeTurnedOff() const {
|
||||||
|
return (fxVolume <= 0 && musicVolume <= 0 && ambientVolume <= 0);
|
||||||
|
}
|
||||||
|
|
||||||
void SoundRenderer::loadConfig() {
|
void SoundRenderer::loadConfig() {
|
||||||
Config &config= Config::getInstance();
|
Config &config= Config::getInstance();
|
||||||
|
|
||||||
|
@@ -83,6 +83,8 @@ public:
|
|||||||
bool wasInitOk() const;
|
bool wasInitOk() const;
|
||||||
|
|
||||||
bool runningThreaded() const { return runThreadSafe; }
|
bool runningThreaded() const { return runThreadSafe; }
|
||||||
|
|
||||||
|
bool isVolumeTurnedOff() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
Reference in New Issue
Block a user