Changeset 7299 in orxonox.OLD for trunk/src/lib/sound/sound_source.cc
- Timestamp:
- Apr 16, 2006, 5:48:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/sound_source.cc
r7297 r7299 31 31 this->setClassID(CL_SOUND_SOURCE, "SoundSource"); 32 32 33 ALenum result;34 35 33 // adding the Source to the SourcesList of the SoundEngine 36 34 this->buffer = buffer; … … 39 37 this->sourceID = 0; 40 38 this->bPlay = false; 39 } 40 41 /** 42 * @brief construct a SoundSource out of the another soundSource 43 * @param source the Source to create this source from. 44 * 45 * Copies the buffer from source to this Source. 46 * Acquires a new SourceID if source is Playing. 47 */ 48 SoundSource::SoundSource(const SoundSource& source) 49 { 50 this->setClassID(CL_SOUND_SOURCE, "SoundSource"); 51 52 // adding the Source to the SourcesList of the SoundEngine 53 this->buffer = source.buffer; 54 this->sourceNode = source.sourceNode; 55 56 this->sourceID = 0; 57 if (source.bPlay == true) 58 { 59 this->bPlay = true; 60 SoundEngine::getInstance()->popALSource(this->sourceID); 61 } 62 else 63 this->bPlay = false; 64 } 65 66 /** 67 * @brief paste a copy of the source into this Source. 68 * @param source the SoundSource to paste into this one. 69 * @returns a Reference to this Source. 70 * 71 */ 72 SoundSource& SoundSource::operator=(const SoundSource& source) 73 { 74 this->buffer = source.buffer; 75 this->sourceNode = sourceNode; 76 77 if (source.bPlay) 78 this->play(); 79 else 80 this->stop(); 81 } 82 83 /** 84 * @brief compares two Sources with each other. 85 * @param source the Source to compare against this One. 86 * Two Sources are the same, if the PNodes match, and the Sound Played are the same. 87 * The alSource must not match, because no two Sources can have the same alSource. 88 */ 89 bool SoundSource::operator==(const SoundSource& source) 90 { 91 return (this->buffer == source.buffer && 92 this->bPlay == source.bPlay && 93 this->sourceNode == source.sourceNode); 41 94 } 42 95 … … 77 130 } 78 131 } 79 // assert (this->sourceID != 0);132 // assert (this->sourceID != 0); 80 133 81 134 alSourceStop(this->sourceID);
Note: See TracChangeset
for help on using the changeset viewer.