Changeset 7647 in orxonox.OLD for branches/atmospheric_engine/src
- Timestamp:
- May 17, 2006, 1:40:05 PM (19 years ago)
- Location:
- branches/atmospheric_engine/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/sound/sound_source.cc
r7646 r7647 122 122 alSourceStop(this->sourceID); 123 123 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 124 alSourcei (this->sourceID, AL_LOOPING, AL_FALSE ); 124 125 alSourcePlay(this->sourceID); 125 126 … … 145 146 alSourceStop(this->sourceID); 146 147 alSourcei (this->sourceID, AL_BUFFER, buffer->getID()); 148 alSourcei (this->sourceID, AL_LOOPING, AL_FALSE ); 147 149 alSourcePlay(this->sourceID); 148 150 … … 157 159 158 160 /** 159 * @brief Plays back buffer on this Source and loops it 161 * @brief Plays and loops a SoundSource 162 */ 163 void SoundSource::loop() 164 { 165 if (this->buffer && this->retrieveSource()) 166 { 167 if (this->bPlay) 168 alSourceStop(this->sourceID); 169 170 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 171 alSourcei (this->sourceID, AL_LOOPING, AL_TRUE ); 172 alSourcePlay(this->sourceID); 173 174 if (DEBUG >= 3) 175 SoundEngine::checkError("Play LoopSource", __LINE__); 176 this->bPlay = true; 177 } 178 } 179 180 181 /** 182 * @brief Plays and loops buffer on this Source 160 183 * @param buffer the buffer to play back on this Source 161 184 */ -
branches/atmospheric_engine/src/lib/sound/sound_source.h
r7646 r7647 28 28 void play(); 29 29 void play(const SoundBuffer* buffer); 30 void loop(); 30 31 void loop(const SoundBuffer* buffer); 31 32 void stop(); -
branches/atmospheric_engine/src/world_entities/space_ships/helicopter.cc
r7337 r7647 25 25 26 26 #include "util/loading/factory.h" 27 #include "util/loading/resource_manager.h" 28 27 29 #include "key_mapper.h" 28 30 #include "event_handler.h" … … 96 98 this->getWeaponManager().changeWeaponConfig(1); 97 99 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 100 101 //load sound 102 if (this->chopperBuffer != NULL) 103 ResourceManager::getInstance()->unload(this->chopperBuffer); 104 this->chopperBuffer = (SoundBuffer*)ResourceManager::getInstance()->load("sound/chopper.wav", WAV); 105 98 106 } 99 107 … … 205 213 State::getCameraNode()->setParentSoft(this->getWeaponManager().getFixedTarget()); 206 214 State::getCameraTargetNode()->setParentSoft(this->getWeaponManager().getFixedTarget()); 215 216 this->soundSource.loop(this->chopperBuffer); 217 PRINTF(0)( "Playing ChopperSound\n" ); 207 218 } 208 219 -
branches/atmospheric_engine/src/world_entities/space_ships/helicopter.h
r7346 r7647 10 10 #include "playable.h" 11 11 12 #include "sound_buffer.h" 13 #include "sound_source.h" 12 14 13 15 class Helicopter : public Playable … … 71 73 float airViscosity; 72 74 75 SoundSource soundSource; 76 SoundBuffer* chopperBuffer; 77 73 78 }; 74 79
Note: See TracChangeset
for help on using the changeset viewer.