Changeset 2980 for code/branches
- Timestamp:
- May 18, 2009, 2:24:34 PM (16 years ago)
- Location:
- code/branches/sound/src/orxonox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound/src/orxonox/OrxonoxPrereqs.h
r2826 r2980 257 257 class GSServer; 258 258 class GSClient; 259 class GSGUI; 259 class GSGUI; 260 261 //sound 262 class SoundBase; 263 class SoundManger; 260 264 } 261 265 -
code/branches/sound/src/orxonox/objects/Level.cc
r2966 r2980 41 41 #include "objects/gametypes/Gametype.h" 42 42 #include "overlays/OverlayGroup.h" 43 #include "sound/SoundBase.h" 43 44 44 45 #include "util/Math.h" … … 57 58 if (this->xmlfilename_.length() >= Core::getMediaPathString().length()) 58 59 this->xmlfilename_ = this->xmlfilename_.substr(Core::getMediaPathString().length()); 59 60 this->sndmgr_ = new SoundManager();61 60 } 62 61 … … 70 69 if (this->xmlfile_) 71 70 Loader::unload(this->xmlfile_); 72 71 73 72 if(this->ambientsound_ != NULL) 74 73 delete this->ambientsound_; 75 76 delete this->sndmgr_;77 74 } 78 75 } … … 84 81 XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode); 85 82 XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype"); 86 83 87 84 XMLPortParamLoadOnly(Level, "ambientsound", loadAmbientSound, xmlelement, mode); 88 85 … … 165 162 { 166 163 this->ambientsound_ = new SoundBase(); 167 this->sndmgr_->addSound(this->ambientsound_);168 164 } 169 165 -
code/branches/sound/src/orxonox/objects/Level.h
r2966 r2980 33 33 34 34 #include "network/synchronisable/Synchronisable.h" 35 #include "sound/SoundBase.h"36 #include "sound/SoundManager.h"37 35 #include "core/BaseObject.h" 38 36 … … 73 71 XMLFile* xmlfile_; 74 72 std::list<BaseObject*> objects_; 75 SoundManager* sndmgr_; 73 76 74 SoundBase* ambientsound_; 77 75 }; -
code/branches/sound/src/orxonox/objects/items/Engine.cc
r2662 r2980 36 36 #include "objects/worldentities/pawns/SpaceShip.h" 37 37 #include "tools/Shader.h" 38 #include "sound/SoundBase.h" 38 39 39 40 namespace orxonox … … 95 96 XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode); 96 97 XMLPortParam(Engine, "accelerationupdown", setAccelerationUpDown, setAccelerationUpDown, xmlelement, mode); 98 99 XMLPortParamLoadOnly(Engine, "sound", loadSound, xmlelement, mode); 97 100 } 98 101 … … 219 222 { 220 223 this->ship_ = ship; 224 this->sound_->attachToEntity(ship); 225 221 226 if (ship) 222 227 { … … 240 245 return Vector3::ZERO; 241 246 } 247 248 void Engine::loadSound(const std::string filename) 249 { 250 if(filename == "") return; 251 else 252 { 253 if(this->sound_ == NULL) 254 { 255 this->sound_ = new SoundBase(this->ship_); 256 } 257 258 this->sound_->loadFile(filename); 259 this->sound_->play(true); 260 } 261 } 242 262 } -
code/branches/sound/src/orxonox/objects/items/Engine.h
r2662 r2980 107 107 virtual const Vector3& getDirection() const; 108 108 109 void loadSound(const std::string filename); 110 109 111 private: 110 112 void networkcallback_shipID(); … … 129 131 Shader* boostBlur_; 130 132 float blurStrength_; 133 134 SoundBase* sound_; 131 135 }; 132 136 } -
code/branches/sound/src/orxonox/sound/SoundBase.cc
r2968 r2980 31 31 #include "orxonox/objects/worldentities/WorldEntity.h" 32 32 #include "util/Math.h" 33 #include "SoundBase.h" 33 34 #include "SoundManager.h" 34 #include "SoundBase.h"35 35 36 36 namespace orxonox 37 37 { 38 SoundBase::SoundBase() 39 { 40 this->source_ = 0; 41 this->buffer_ = 0; 42 this->entity_ = NULL; 43 } 38 SoundManager* SoundBase::soundmanager_s = NULL; 44 39 45 40 SoundBase::SoundBase(WorldEntity* entity) 46 41 { 42 if(SoundBase::soundmanager_s == NULL) 43 { 44 SoundBase::soundmanager_s = new SoundManager(); 45 } 46 47 47 this->source_ = 0; 48 48 this->buffer_ = 0; 49 49 this->entity_ = entity; 50 51 SoundBase::soundmanager_s->addSound(this); 50 52 } 51 53 -
code/branches/sound/src/orxonox/sound/SoundBase.h
r2967 r2980 36 36 class SoundManager; 37 37 class WorldEntity; 38 38 39 /** 39 40 * The SoudBase class is the base class for all sound file loader classes. … … 44 45 { 45 46 public: 46 SoundBase(); 47 SoundBase(WorldEntity* entity); 47 SoundBase(WorldEntity* entity = NULL); 48 48 ~SoundBase(); 49 49 … … 67 67 68 68 ALint getSourceState(); 69 70 static SoundManager* soundmanager_s; 69 71 }; // class SoundBase 70 72 } // namepsace orxonox -
code/branches/sound/src/orxonox/sound/SoundManager.cc
r2966 r2980 54 54 if(SoundManager::device_s == NULL) 55 55 { 56 COUT(3) << "OpenAL: open sound device..." << std::endl;56 COUT(3) << "OpenAL: Open sound device..." << std::endl; 57 57 SoundManager::device_s = alcOpenDevice(NULL); 58 58 } … … 64 64 else 65 65 { 66 COUT(3) << "OpenAL: Sound device opened"; 66 67 this->context_ = alcCreateContext(SoundManager::device_s, NULL); 67 68 if(this->context_ == NULL) … … 71 72 else 72 73 { 74 COUT(3) << "OpenAL: Context " << this->context_ << "loaded"; 73 75 alcMakeContextCurrent(this->context_); 74 76 }
Note: See TracChangeset
for help on using the changeset viewer.