Changeset 5917 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Dec 4, 2005, 9:27:18 PM (19 years ago)
- Location:
- trunk/src/lib/sound
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/sound_engine.cc
r5915 r5917 305 305 } 306 306 307 308 /** 309 * Allocates openAL sources 310 * @param count how many sources to allocate 311 * @returns true on success, false if at least one source could not be allocated 312 */ 313 bool SoundEngine::allocateSources(unsigned int count) 314 { 315 ALuint* sourceList = new ALuint[count]; 316 ALenum result; 317 318 alGenSources(count, sourceList); 319 if ((result = alGetError()) != AL_NO_ERROR) 320 { 321 SoundEngine::PrintALErrorString(result); 322 return false; 323 } 324 325 /// @TODO check syntax 326 327 328 // Setting default values. 329 for (int i = 0; i < count; i++) 330 { 331 alSourcef (sourceList[i], AL_PITCH, 1.0 ); 332 alSourcef (sourceList[i], AL_GAIN, this->getEffectsVolume() ); 333 alSourcei (sourceList[i], AL_LOOPING, AL_FALSE ); 334 this->ALSources.push(sourceList[i]); 335 } 336 return true; 337 } 338 307 339 /** 308 340 * Transforms AL-errors into something readable -
trunk/src/lib/sound/sound_engine.h
r5885 r5917 14 14 15 15 #include <list> 16 #include <stack> 16 17 17 18 #define SOUND_DOPPLER_FACTOR 0.001 //!< A factor for the audible doppler effect … … 21 22 class PNode; 22 23 class IniParser; 24 23 25 24 26 //! A class that handles audio via the openAudioLibrary … … 54 56 void flushAllBuffers(); 55 57 void flushAllSources(); 58 59 bool allocateSources(unsigned int count); 56 60 bool initAudio(); 57 61 … … 78 82 const std::list<BaseObject*>* sourceList; //!< A list for all the sources in the scene. 79 83 80 84 unsigned int maxSourceCount; //!< How many Sources is the Maximum 85 std::stack<ALuint> ALSources; //!< A list of real openAL-Sources, the engine allocates, and stores for reuse. 81 86 }; 82 87 -
trunk/src/lib/sound/sound_source.cc
r5386 r5917 18 18 #include "sound_source.h" 19 19 #include "sound_engine.h" 20 20 21 #include "alincl.h" 21 22 #include "compiler.h" -
trunk/src/lib/sound/sound_source.h
r5386 r5917 39 39 40 40 private: 41 bool bPlay; //!< If the Source is Playing. 41 42 ALuint sourceID; //!< The ID of the Source 42 43 const SoundBuffer* buffer; //!< The buffer to play in this source.
Note: See TracChangeset
for help on using the changeset viewer.