Changeset 5961 in orxonox.OLD for branches/avi_play/src/lib/sound/sound_source.cc
- Timestamp:
- Dec 7, 2005, 2:53:43 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/avi_play/src/lib/sound/sound_source.cc
r5924 r5961 34 34 35 35 // adding the Source to the SourcesList of the SoundEngine 36 SoundEngine::getInstance()->addSource(this);37 38 36 this->buffer = buffer; 39 37 this->sourceNode = sourceNode; 40 38 41 alGenSources(1, &this->sourceID); 42 if ((result = alGetError()) != AL_NO_ERROR) 43 SoundEngine::PrintALErrorString(result); 44 if (this->buffer != NULL) 45 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 46 alSourcef (this->sourceID, AL_PITCH, 1.0 ); 47 alSourcef (this->sourceID, AL_GAIN, SoundEngine::getInstance()->getEffectsVolume() ); 48 alSourcei (sourceID, AL_LOOPING, AL_FALSE ); 39 this->sourceID = 0; 40 this->bPlay = false; 49 41 } 50 42 … … 54 46 SoundSource::~SoundSource() 55 47 { 56 //SoundEngine::getInstance()->removeSource(this); 57 alDeleteSources(1, &this->sourceID); 48 SoundEngine::getInstance()->pushALSource(this->sourceID); 58 49 } 59 50 … … 63 54 void SoundSource::play() 64 55 { 56 if (this->sourceID == 0) 57 SoundEngine::getInstance()->popALSource(this->sourceID); 65 58 alSourcePlay(this->sourceID); 59 this->bPlay = true; 66 60 } 67 61 … … 72 66 void SoundSource::play(const SoundBuffer* buffer) 73 67 { 68 if (unlikely(this->sourceID == 0)) 69 SoundEngine::getInstance()->popALSource(this->sourceID); 70 71 printf("%d\n",sourceID); 74 72 alSourceStop(this->sourceID); 75 73 alSourcei (this->sourceID, AL_BUFFER, buffer->getID()); … … 78 76 if (unlikely(this->buffer != NULL)) 79 77 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 78 this->bPlay = true; 80 79 } 81 80 … … 85 84 void SoundSource::stop() 86 85 { 86 this->bPlay = false; 87 87 alSourceStop(this->sourceID); 88 SoundEngine::getInstance()->pushALSource(this->sourceID); 88 89 } 89 90
Note: See TracChangeset
for help on using the changeset viewer.