Changeset 7318 in orxonox.OLD for trunk/src/lib/sound
- Timestamp:
- Apr 17, 2006, 2:55:51 AM (19 years ago)
- Location:
- trunk/src/lib/sound
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/sound_engine.cc
r7317 r7318 124 124 * @param sourceNode The sourceNode to bind this SoundSource to. 125 125 * @returns The newly created SoundSource 126 127 126 * 127 * acctualy this is nothing more than a wrapper around the ResourceManager. 128 128 */ 129 129 SoundSource* SoundEngine::createSource(const std::string& fileName, PNode* sourceNode) 130 130 { 131 return new SoundSource(sourceNode, (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL)); 131 SoundBuffer* buffer = NULL; 132 if (!fileName.empty()) 133 { 134 buffer= (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL); 135 if (buffer == NULL) 136 PRINTF(2)("Wav-Sound %s could not be loaded onto new Source\n", fileName.c_str()); 137 } 138 return new SoundSource(sourceNode, buffer); 132 139 } 133 140 … … 151 158 * @param source the Source to fill with the Value. 152 159 */ 153 boolSoundEngine::popALSource(ALuint& source)160 void SoundEngine::popALSource(ALuint& source) 154 161 { 155 162 assert (source == 0); 156 157 163 /// @TODO try to create more sources if needed 158 164 if (!this->ALSources.empty()) … … 162 168 this->ALSources.pop(); 163 169 SDL_mutexV(this->sourceMutex); 164 return true; 165 } 166 else 167 return false; 170 } 168 171 } 169 172 -
trunk/src/lib/sound/sound_engine.h
r7317 r7318 49 49 50 50 // administrative 51 boolpopALSource(ALuint& source);51 void popALSource(ALuint& source); 52 52 void pushALSource(ALuint& source); 53 53 -
trunk/src/lib/sound/sound_source.cc
r7317 r7318 117 117 void SoundSource::play() 118 118 { 119 if (this->retrieveSource()) 120 { 121 alSourcePlay(this->sourceID); 119 if (this->buffer && this->retrieveSource()) 120 { 121 if (this->bPlay) 122 alSourceStop(this->sourceID); 123 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 124 alSourcePlay(this->sourceID); 125 122 126 if (DEBUG >= 3) 123 127 SoundEngine::checkError("Play Source", __LINE__);
Note: See TracChangeset
for help on using the changeset viewer.