Changeset 6071 for code/branches/sound3/src/orxonox/sound/AmbientSound.cc
- Timestamp:
- Nov 15, 2009, 10:36:45 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound3/src/orxonox/sound/AmbientSound.cc
r6069 r6071 32 32 #include "core/EventIncludes.h" 33 33 #include "core/GameMode.h" 34 #include "core/Resource.h" 34 35 #include "core/XMLPort.h" 35 36 #include "SoundManager.h" 37 #include "MoodManager.h" 36 38 37 39 namespace orxonox … … 56 58 SUPER(AmbientSound, XMLPort, xmlelement, mode); 57 59 XMLPortParamExtern(AmbientSound, BaseSound, this, "volume", setVolume, getVolume, xmlelement, mode); 58 XMLPortParamExtern(AmbientSound, BaseSound, this, "loop", setLoop , getLoop, xmlelement, mode);59 XMLPortParamExtern(AmbientSound, BaseSound, this, "play OnLoad", setPlayOnLoad, getPlayOnLoad, xmlelement, mode);60 XMLPortParam Extern(AmbientSound, BaseSound, this, "source", setSource, getSource, xmlelement, mode);60 XMLPortParamExtern(AmbientSound, BaseSound, this, "loop", setLooping, getLooping, xmlelement, mode); 61 XMLPortParamExtern(AmbientSound, BaseSound, this, "play", play, isPlaying, xmlelement, mode); 62 XMLPortParam(AmbientSound, "source", setAmbientSource, getAmbientSource, xmlelement, mode); 61 63 } 62 64 … … 107 109 } 108 110 109 void AmbientSound::set Source(const std::string& source)111 void AmbientSound::setAmbientSource(const std::string& source) 110 112 { 113 this->ambientSource_ = source; 111 114 if (GameMode::playsSound()) 112 115 { 113 std::string filePath = SoundManager::getInstance().getAmbientPath(source); 114 if (!filePath.empty()) 115 { 116 BaseSound::setSource(filePath); 117 return; 118 } 119 COUT(3) << "Sound: " << source << ": Not a valid name! Ambient sound will not change." << std::endl; 116 std::string path = "ambient/" + MoodManager::getInstance().getMood() + "/" + source; 117 shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path); 118 if (fileInfo != NULL) 119 this->setSource(path); 120 else 121 COUT(3) << "Sound: " << source << ": Not a valid name! Ambient sound will not change." << std::endl; 120 122 } 121 123 }
Note: See TracChangeset
for help on using the changeset viewer.