Changeset 2980 for code/branches/sound/src/orxonox/objects
- Timestamp:
- May 18, 2009, 2:24:34 PM (16 years ago)
- Location:
- code/branches/sound/src/orxonox/objects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.