Changeset 9805 in orxonox.OLD for branches/new_class_id/src/lib/sound/sound_source.cc
- Timestamp:
- Sep 24, 2006, 3:21:12 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/sound/sound_source.cc
r9715 r9805 19 19 #include "sound_engine.h" 20 20 21 #include "alincl.h"22 21 #include "compiler.h" 23 22 #include "debug.h" … … 29 28 * @brief creates a SoundSource at position sourceNode with the SoundBuffer buffer 30 29 */ 31 SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer *buffer)30 SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer& buffer) 32 31 { 33 32 this->registerObject(this, SoundSource::_objectList); … … 120 119 void SoundSource::play() 121 120 { 122 if (this-> buffer && this->retrieveSource())121 if (this->retrieveSource()) 123 122 { 124 123 if (this->bPlay) 125 124 alSourceStop(this->sourceID); 126 125 127 alSourcei (this->sourceID, AL_BUFFER, this->buffer ->getID());126 alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID()); 128 127 alSourcei (this->sourceID, AL_LOOPING, AL_FALSE); 129 128 alSourcef (this->sourceID, AL_GAIN, 1); … … 141 140 * @param buffer the buffer to play back on this Source 142 141 */ 143 void SoundSource::play(const SoundBuffer *buffer)142 void SoundSource::play(const SoundBuffer& buffer) 144 143 { 145 144 if (!this->retrieveSource()) … … 150 149 151 150 alSourceStop(this->sourceID); 152 alSourcei (this->sourceID, AL_BUFFER, buffer ->getID());151 alSourcei (this->sourceID, AL_BUFFER, buffer.getID()); 153 152 alSourcei (this->sourceID, AL_LOOPING, AL_FALSE); 154 153 alSourcef (this->sourceID, AL_GAIN, 1); … … 156 155 alSourcePlay(this->sourceID); 157 156 158 if (unlikely(this->buffer != NULL))159 alSourcei (this->sourceID, AL_BUFFER, this->buffer ->getID());157 if (unlikely(this->buffer.getID() != 0)) 158 alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID()); 160 159 this->bPlay = true; 161 160 … … 170 169 * @param gain the gain of the sound buffer 171 170 */ 172 void SoundSource::play(const SoundBuffer *buffer, float gain)171 void SoundSource::play(const SoundBuffer& buffer, float gain) 173 172 { 174 173 if (!this->retrieveSource()) … … 179 178 180 179 alSourceStop(this->sourceID); 181 alSourcei (this->sourceID, AL_BUFFER, buffer ->getID());180 alSourcei (this->sourceID, AL_BUFFER, buffer.getID()); 182 181 alSourcei (this->sourceID, AL_LOOPING, AL_FALSE); 183 182 alSourcef (this->sourceID, AL_GAIN, gain); … … 185 184 alSourcePlay(this->sourceID); 186 185 187 if (unlikely(this->buffer != NULL))188 alSourcei (this->sourceID, AL_BUFFER, this->buffer ->getID());186 if (unlikely(this->buffer.getID() != 0)) 187 alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID()); 189 188 this->bPlay = true; 190 189 … … 199 198 * @param loop if true, sound gets looped 200 199 */ 201 void SoundSource::play(const SoundBuffer *buffer, float gain, bool loop)200 void SoundSource::play(const SoundBuffer& buffer, float gain, bool loop) 202 201 { 203 202 if (!this->retrieveSource()) … … 208 207 209 208 alSourceStop(this->sourceID); 210 alSourcei (this->sourceID, AL_BUFFER, buffer ->getID());209 alSourcei (this->sourceID, AL_BUFFER, buffer.getID()); 211 210 212 211 if (loop) … … 219 218 alSourcePlay(this->sourceID); 220 219 221 if (unlikely(this->buffer != NULL))222 alSourcei (this->sourceID, AL_BUFFER, this->buffer ->getID());220 if (unlikely(this->buffer.getID() != 0)) 221 alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID()); 223 222 this->bPlay = true; 224 223 … … 232 231 * @param gain the new gain value 233 232 */ 234 void SoundSource::gain(const SoundBuffer *buffer, float gain)233 void SoundSource::gain(const SoundBuffer& buffer, float gain) 235 234 { 236 235 // alSourcei (this->sourceID, AL_BUFFER, buffer->getID()); … … 347 346 * @param duration time perios to fade in 348 347 */ 349 void SoundSource::fadein(const SoundBuffer *buffer, ALfloat duration)348 void SoundSource::fadein(const SoundBuffer& buffer, ALfloat duration) 350 349 { 351 350 //if (this->buffer && this->retrieveSource())
Note: See TracChangeset
for help on using the changeset viewer.