|
From: Seb <whi...@us...> - 2004-10-16 15:26:57
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32572 Modified Files: soundmanager.cc soundmanager.h Log Message: Ajout d'une MainLoop geree par un thread Activation/Desactivation du son par la console: -set sound 0 ou -set sound 1 Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** soundmanager.cc 16 Oct 2004 14:38:28 -0000 1.9 --- soundmanager.cc 16 Oct 2004 15:26:48 -0000 1.10 *************** *** 23,26 **** --- 23,28 ---- Init(); + + LoopThread = SDL_CreateThread(SoundManager::MainLoop,NULL); } *************** *** 73,76 **** --- 75,99 ---- } + // Main Loop running in LoopThread + int SoundManager::MainLoop(void* arg) + { + bool done = false; + int* check; + + while (!done) + { + check = &Engine::pVarManager->GetVar("sound")->intValue; + + if(!*check) + pSoundManager->DisableSoundManager(); + else + pSoundManager->EnableSoundManager(); + + SDL_Delay(80); + } + + return 0; + } + // Disable the Sound Manager and stop all sounds in list void SoundManager::DisableSoundManager() *************** *** 79,84 **** for (; iter!=SoundList.end(); iter++) alSourceStop(iter->second); - - Engine::pVarManager->AddVar("sound", 0); } --- 102,105 ---- *************** *** 86,90 **** void SoundManager::EnableSoundManager() { - Engine::pVarManager->AddVar("sound", 1); } --- 107,110 ---- Index: soundmanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** soundmanager.h 16 Oct 2004 14:38:28 -0000 1.4 --- soundmanager.h 16 Oct 2004 15:26:48 -0000 1.5 *************** *** 23,26 **** --- 23,32 ---- #include <vorbis/vorbisfile.h> + #ifdef TGWIN32 + #include <SDL/SDL_thread.h> + #else + #include <SDL_thread.h> + #endif + #include "engine.h" *************** *** 70,75 **** --- 76,85 ---- int endian; // 0 for Little-Endian, 1 for Big-Endian + + SDL_Thread *LoopThread; void Init(); + + static int MainLoop(void* arg); string GetALErrorString(ALenum err); |