just for you tomreyn (fade sound on application exit)
This commit is contained in:
parent
c305af8063
commit
b10c489418
|
@ -2400,6 +2400,10 @@ int glestMain(int argc, char** argv) {
|
||||||
ExceptionHandler exceptionHandler;
|
ExceptionHandler exceptionHandler;
|
||||||
exceptionHandler.install( getCrashDumpFileName() );
|
exceptionHandler.install( getCrashDumpFileName() );
|
||||||
|
|
||||||
|
const int shutdownFadeSoundMilliseconds = 3500;
|
||||||
|
Chrono chronoshutdownFadeSound;
|
||||||
|
SimpleTaskThread *soundThreadManager = NULL;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Setup paths to game items (like data, logs, ini etc)
|
// Setup paths to game items (like data, logs, ini etc)
|
||||||
int setupResult = setupGameItemPaths(argc, argv, NULL);
|
int setupResult = setupGameItemPaths(argc, argv, NULL);
|
||||||
|
@ -3430,6 +3434,15 @@ int glestMain(int argc, char** argv) {
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] starting normal application shutdown\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] starting normal application shutdown\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
if(isMasterServerModeEnabled == false) {
|
||||||
|
soundThreadManager = program->getSoundThreadManager(true);
|
||||||
|
if(soundThreadManager) {
|
||||||
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
soundRenderer.stopAllSounds(shutdownFadeSoundMilliseconds);
|
||||||
|
chronoshutdownFadeSound.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cleanupCRCThread();
|
cleanupCRCThread();
|
||||||
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__);
|
||||||
|
|
||||||
|
@ -3437,16 +3450,52 @@ 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(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
catch(const exception &e){
|
catch(const exception &e) {
|
||||||
|
if(isMasterServerModeEnabled == false) {
|
||||||
|
soundThreadManager = program->getSoundThreadManager(true);
|
||||||
|
if(soundThreadManager) {
|
||||||
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
soundRenderer.stopAllSounds(shutdownFadeSoundMilliseconds);
|
||||||
|
chronoshutdownFadeSound.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExceptionHandler::handleRuntimeError(e.what());
|
ExceptionHandler::handleRuntimeError(e.what());
|
||||||
}
|
}
|
||||||
catch(const char *e){
|
catch(const char *e) {
|
||||||
|
if(isMasterServerModeEnabled == false) {
|
||||||
|
soundThreadManager = program->getSoundThreadManager(true);
|
||||||
|
if(soundThreadManager) {
|
||||||
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
soundRenderer.stopAllSounds(shutdownFadeSoundMilliseconds);
|
||||||
|
chronoshutdownFadeSound.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExceptionHandler::handleRuntimeError(e);
|
ExceptionHandler::handleRuntimeError(e);
|
||||||
}
|
}
|
||||||
catch(const string &ex){
|
catch(const string &ex) {
|
||||||
|
if(isMasterServerModeEnabled == false) {
|
||||||
|
soundThreadManager = program->getSoundThreadManager(true);
|
||||||
|
if(soundThreadManager) {
|
||||||
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
soundRenderer.stopAllSounds(shutdownFadeSoundMilliseconds);
|
||||||
|
chronoshutdownFadeSound.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExceptionHandler::handleRuntimeError(ex.c_str());
|
ExceptionHandler::handleRuntimeError(ex.c_str());
|
||||||
}
|
}
|
||||||
catch(...){
|
catch(...) {
|
||||||
|
if(isMasterServerModeEnabled == false) {
|
||||||
|
soundThreadManager = program->getSoundThreadManager(true);
|
||||||
|
if(soundThreadManager) {
|
||||||
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
soundRenderer.stopAllSounds(shutdownFadeSoundMilliseconds);
|
||||||
|
chronoshutdownFadeSound.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ExceptionHandler::handleRuntimeError("Unknown error!");
|
ExceptionHandler::handleRuntimeError("Unknown error!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3470,6 +3519,17 @@ int glestMain(int argc, char** argv) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
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) {
|
||||||
|
//printf("chronoshutdownFadeSound.getMillis() = %llu\n",chronoshutdownFadeSound.getMillis());
|
||||||
|
for(;chronoshutdownFadeSound.getMillis() <= shutdownFadeSoundMilliseconds;) {
|
||||||
|
sleep(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseThread::shutdownAndWait(soundThreadManager);
|
||||||
|
delete soundThreadManager;
|
||||||
|
soundThreadManager = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -712,4 +712,12 @@ void Program::consoleAddLine(string line) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SimpleTaskThread * Program::getSoundThreadManager(bool takeOwnership) {
|
||||||
|
SimpleTaskThread *result = soundThreadManager;
|
||||||
|
if(takeOwnership) {
|
||||||
|
soundThreadManager = NULL;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
|
@ -201,6 +201,8 @@ public:
|
||||||
|
|
||||||
virtual void consoleAddLine(string line);
|
virtual void consoleAddLine(string line);
|
||||||
|
|
||||||
|
virtual SimpleTaskThread * getSoundThreadManager(bool takeOwnership);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void setDisplaySettings();
|
void setDisplaySettings();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user