Changeset 4883 in orxonox.OLD for orxonox/branches/weaponSystem/src/lib/sound/sound_engine.cc
- Timestamp:
- Jul 17, 2005, 4:02:36 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/weaponSystem/src/lib/sound/sound_engine.cc
r4880 r4883 91 91 * creates a SoundSource at position sourceNode with the SoundBuffer buffer 92 92 */ 93 SoundSource::SoundSource( SoundBuffer* buffer, PNode* sourceNode)93 SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer* buffer) 94 94 { 95 95 this->setClassID(CL_SOUND_SOURCE, "SoundSource"); … … 106 106 if ((result = alGetError()) != AL_NO_ERROR) 107 107 SoundEngine::PrintALErrorString(result); 108 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 108 if (this->buffer != NULL) 109 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 109 110 alSourcef (this->sourceID, AL_PITCH, 1.0 ); 110 111 alSourcef (this->sourceID, AL_GAIN, 1.0 ); … … 127 128 { 128 129 alSourcePlay(this->sourceID); 130 } 131 132 /** 133 * Plays back buffer on this Source 134 * @param buffer the buffer to play back on this Source 135 */ 136 void SoundSource::play(const SoundBuffer* buffer) 137 { 138 alSourcei (this->sourceID, AL_BUFFER, buffer->getID()); 139 alSourcePlay(this->sourceID); 140 // printf("playing sound\n"); 129 141 } 130 142 … … 229 241 SoundSource* SoundEngine::createSource(const char* fileName, PNode* sourceNode) 230 242 { 231 return new SoundSource( (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL), sourceNode);243 return new SoundSource(sourceNode, (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL)); 232 244 } 233 245
Note: See TracChangeset
for help on using the changeset viewer.