- Timestamp:
- Apr 15, 2006, 10:00:35 PM (19 years ago)
- Location:
- trunk/src/lib/sound
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/sound_engine.cc
r7292 r7298 54 54 this->effectsVolume = .80; 55 55 this->musicVolume = .75; 56 57 this->sourceMutex = SDL_CreateMutex(); 56 58 } 57 59 … … 97 99 //alutExit(); 98 100 101 SDL_DestroyMutex(this->sourceMutex); 102 99 103 SoundEngine::singletonRef = NULL; 100 104 } … … 150 154 if (!this->ALSources.empty()) 151 155 { 156 SDL_mutexP(this->sourceMutex); 152 157 source = this->ALSources.top(); 153 158 this->ALSources.pop(); 159 SDL_mutexV(this->sourceMutex); 154 160 printf("Retrieve Source %d\n", source); 155 161 } 156 162 } 163 164 void SoundEngine::pushALSource(ALuint& source) 165 { 166 if (source != 0) 167 { 168 SDL_mutexP(this->sourceMutex); 169 this->ALSources.push(source); 170 SDL_mutexV(this->sourceMutex); 171 } 172 }; 157 173 158 174 -
trunk/src/lib/sound/sound_engine.h
r7256 r7298 15 15 #include <list> 16 16 #include <stack> 17 #include <SDL_thread.h> 17 18 18 19 #define SOUND_DOPPLER_FACTOR 0.001 //!< A factor for the audible doppler effect … … 49 50 // administrative 50 51 void popALSource(ALuint& source); 51 void pushALSource(ALuint& source) { if (source != 0) this->ALSources.push(source); };52 void pushALSource(ALuint& source); 52 53 53 54 void flushUnusedBuffers(); … … 84 85 unsigned int maxSourceCount; //!< How many Sources is the Maximum 85 86 std::stack<ALuint> ALSources; //!< A list of real openAL-Sources, the engine allocates, and stores for reuse. 87 88 SDL_mutex* sourceMutex; //!< A mutex so we can not harm the stack 86 89 }; 87 90
Note: See TracChangeset
for help on using the changeset viewer.