Changeset 4197 in orxonox.OLD for orxonox/branches
- Timestamp:
- May 16, 2005, 3:54:06 PM (20 years ago)
- Location:
- orxonox/branches/openAL/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/openAL/src/lib/sound/sound_engine.cc
r4196 r4197 17 17 18 18 #include "sound_engine.h" 19 19 20 #include "p_node.h" 20 21 #include "list.h" … … 23 24 24 25 26 ////////////////// 27 /* SOUND-BUFFER */ 28 ////////////////// 25 29 /** 26 30 \brief Creates a Soundbuffer out of an inputfile … … 46 50 } 47 51 48 49 52 ////////////////// 53 /* SOUND-SOURCE */ 54 ////////////////// 50 55 /** 51 56 \brief creates a SoundSource at position sourceNode with the SoundBuffer buffer … … 57 62 this->buffer = buffer; 58 63 this->sourceNode = sourceNode; 64 65 alGenSources(1, &this->sourceID); 66 67 if(alGetError() != AL_NO_ERROR) 68 PRINTF(1)("error initializing SoundSource\n"); //return AL_FALSE; 69 70 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 71 alSourcef (this->sourceID, AL_PITCH, 1.0 ); 72 alSourcef (this->sourceID, AL_GAIN, 1.0 ); 73 // alSourcefv(sourceID, AL_POSITION, SourcePos); 74 // alSourcefv(sourceID, AL_VELOCITY, SourceVel); 75 alSourcei (sourceID, AL_LOOPING, true ); 76 77 59 78 } 60 79 … … 64 83 } 65 84 85 86 void SoundSource::play() 87 { 88 alSourcePlay(this->sourceID); 89 } 90 void SoundSource::stop() 91 { 92 alSourceStop(this->sourceID); 93 } 94 void SoundSource::pause() 95 { 96 alSourcePause(this->sourceID); 97 } 98 99 100 ////////////////// 101 /* SOUND-ENGINE */ 102 ////////////////// 66 103 /** 67 104 \brief standard constructor … … 155 192 absDirV.z); 156 193 } 194 else 195 PRINTF(2)("no listener defined\n"); 196 157 197 // updating all the Sources positions 158 198 tIterator<SoundSource>* iterator = this->sourceList->getIterator(); -
orxonox/branches/openAL/src/lib/sound/sound_engine.h
r4196 r4197 23 23 ~SoundBuffer(void); 24 24 25 inline ALuint getID(void) { return this->bufferID; } 26 25 27 private: 26 28 ALuint bufferID; //!< The address of the Buffer. … … 37 39 ~SoundSource(void); 38 40 41 // user interaction 42 void play(); 43 void stop(); 44 void pause(); 45 46 47 // development functions 39 48 /** \retruns The ID of the Source */ 40 49 inline ALuint getID(void) { return this->sourceID; } -
orxonox/branches/openAL/src/story_entities/world.cc
r4194 r4197 50 50 51 51 #include "substring.h" 52 53 #include "sound_engine.h" 52 54 53 55 using namespace std; … … 486 488 terrain->setRelCoor(Vector(0,-10,0)); 487 489 this->spawn(terrain); 490 491 SoundEngine::getInstance()->setListener(tn); 492 SoundBuffer* tBuffer =new SoundBuffer("explo.wav"); 493 SoundSource* tSound = new SoundSource(tBuffer, this->localPlayer); 494 tSound->play(); 488 495 489 496 … … 1161 1168 this->garbageCollector->update(); 1162 1169 this->nullParent->update (this->dtS); 1170 1171 SoundEngine::getInstance()->update(); 1163 1172 } 1164 1173
Note: See TracChangeset
for help on using the changeset viewer.