Changeset 7854
- Timestamp:
- Feb 11, 2011, 1:03:47 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/data/levels/presentationHS09b.oxw
r7679 r7854 35 35 > 36 36 37 < AmbientSound ambientSource="Mars.ogg" looping="true" playOnLoad="true" />37 <WorldAmbientSound source="Mars.ogg" looping="true" playOnLoad="true" /> 38 38 39 39 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> … … 256 256 <?lua end ?> 257 257 258 < AmbientSound ambientSource="Earth.ogg" looping="true" playOnLoad="false">258 <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="false"> 259 259 <events> 260 260 <activity> … … 262 262 </activity> 263 263 </events> 264 </ AmbientSound>264 </WorldAmbientSound> 265 265 266 266 <SpawnPoint position="5000,0,2000" spawnclass=SpaceShip pawndesign=spaceshipassff team=0 /> -
code/trunk/data/levels/presentationPong.oxw
r7853 r7854 51 51 </templates> 52 52 53 < AmbientSound ambientSource="mainmenu.ogg" playOnLoad=true />53 <WorldAmbientSound source="mainmenu.ogg" playOnLoad=true /> 54 54 55 55 <Scene -
code/trunk/data/levels/sound.oxw
r7679 r7854 29 29 > 30 30 31 < AmbientSound ambientSource="Earth.ogg" looping="true" playOnLoad="true" />32 < AmbientSound ambientSource="Mars.ogg" looping="true">31 <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" /> 32 <WorldAmbientSound source="Mars.ogg" looping="true"> 33 33 <events> 34 34 <activity> … … 40 40 </activity> 41 41 </events> 42 </ AmbientSound>43 < AmbientSound ambientSource="Jupiter.ogg" looping="true">42 </WorldAmbientSound> 43 <WorldAmbientSound source="Jupiter.ogg" looping="true"> 44 44 <events> 45 45 <activity> … … 51 51 </activity> 52 52 </events> 53 </ AmbientSound>53 </WorldAmbientSound> 54 54 55 55 -
code/trunk/src/orxonox/OrxonoxPrereqs.h
r7655 r7854 151 151 class SoundStreamer; 152 152 class WorldSound; 153 class WorldAmbientSound; 153 154 154 155 // weaponsystem -
code/trunk/src/orxonox/gamestates/GSLevel.cc
r7284 r7854 154 154 if (find == this->staticObjects_.end()) 155 155 { 156 COUT(3) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << ')'<< std::endl;156 COUT(3) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << std::endl; 157 157 } 158 158 } -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r7689 r7854 77 77 { 78 78 // Load sound 79 this->ambient_ = new AmbientSound(0); 80 this->ambient_->setSyncMode(0x0); 79 this->ambient_ = new AmbientSound(); 81 80 } 82 81 } -
code/trunk/src/orxonox/sound/AmbientSound.cc
r6417 r7854 29 29 #include "AmbientSound.h" 30 30 31 #include "core/CoreIncludes.h"32 #include "core/EventIncludes.h"33 31 #include "core/GameMode.h" 34 32 #include "core/Resource.h" 35 #include "core/XMLPort.h"36 33 #include "SoundManager.h" 37 34 38 35 namespace orxonox 39 36 { 40 CreateFactory(AmbientSound); 41 42 AmbientSound::AmbientSound(BaseObject* creator) 43 : BaseObject(creator) 44 , Synchronisable(creator) 45 , bPlayOnLoad_(false) 37 AmbientSound::AmbientSound() 38 : bPlayOnLoad_(false) 46 39 { 47 RegisterObject(AmbientSound);48 49 40 // Ambient sounds always fade in 50 41 this->setVolume(0); 51 this->registerVariables();52 42 } 53 43 … … 59 49 SoundManager::getInstance().unregisterAmbientSound(this); 60 50 } 61 }62 63 void AmbientSound::registerVariables()64 {65 registerVariable(ambientSource_, ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::ambientSourceChanged));66 registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::loopingChanged));67 registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::pitchChanged));68 registerVariable(bPlayOnLoad_, ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::playOnLoadChanged));69 }70 71 void AmbientSound::XMLPort(Element& xmlelement, XMLPort::Mode mode)72 {73 SUPER(AmbientSound, XMLPort, xmlelement, mode);74 BaseSound::XMLPortExtern(xmlelement, mode);75 XMLPortParam(AmbientSound, "ambientSource", setAmbientSource, getAmbientSource, xmlelement, mode);76 XMLPortParam(AmbientSound, "playOnLoad", setPlayOnLoad, getPlayOnLoad, xmlelement, mode);77 }78 79 void AmbientSound::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)80 {81 SUPER(AmbientSound, XMLEventPort, xmlelement, mode);82 XMLPortEventState(AmbientSound, BaseObject, "play", play, xmlelement, mode);83 51 } 84 52 … … 132 100 this->play(); 133 101 } 134 135 void AmbientSound::changedActivity()136 {137 SUPER(AmbientSound, changedActivity);138 if (this->isActive())139 this->play();140 else141 this->stop();142 }143 102 } -
code/trunk/src/orxonox/sound/AmbientSound.h
r6417 r7854 33 33 #include "OrxonoxPrereqs.h" 34 34 35 #include "core/BaseObject.h"36 #include "network/synchronisable/Synchronisable.h"37 35 #include "BaseSound.h" 38 36 #include "MoodManager.h" … … 41 39 { 42 40 /** 43 * The AmbientSound class is the base class for all sound file loader classes. 44 * It server as main interface to the OpenAL library. 45 * 41 * The AmbientSound class is used to play background music. It can not be placed 42 * directly in a level file, use WorldAmbientSound instead. 46 43 */ 47 class _OrxonoxExport AmbientSound : public BaseSound, public BaseObject, public Synchronisable, publicMoodListener44 class _OrxonoxExport AmbientSound : public BaseSound, public MoodListener 48 45 { 49 46 friend class SoundManager; 47 friend class WorldAmbientSound; 50 48 51 49 public: 52 AmbientSound(BaseObject* creator); 53 54 void XMLPort(Element& xmlelement, XMLPort::Mode mode); 55 void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); 56 void changedActivity(); 50 AmbientSound(); 57 51 58 52 void play(); … … 73 67 private: 74 68 void preDestroy(); 75 void registerVariables();76 69 float getRealVolume(); 77 70 void moodChanged(const std::string& mood); -
code/trunk/src/orxonox/sound/BaseSound.h
r7163 r7854 41 41 /** 42 42 * The BaseSound class is the base class for all sound file loader classes. 43 * It server as main interface to the OpenAL library. 44 * 43 * It serves as main interface to the OpenAL library. 45 44 */ 46 45 class _OrxonoxExport BaseSound : virtual public OrxonoxClass -
code/trunk/src/orxonox/sound/CMakeLists.txt
r6417 r7854 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 AmbientSound.cc 3 BaseSound.cc 4 SoundBuffer.cc 5 SoundManager.cc 6 WorldSound.cc 7 SoundStreamer.cc 2 AmbientSound.cc 3 BaseSound.cc 4 SoundBuffer.cc 5 SoundManager.cc 6 SoundStreamer.cc 7 WorldAmbientSound.cc 8 WorldSound.cc 8 9 ) 9 10 -
code/trunk/src/orxonox/sound/WorldSound.h
r6417 r7854 38 38 namespace orxonox 39 39 { 40 /* 40 /** 41 41 @brief 42 42 The WorldSound class is to be used for sounds with position and orientation.
Note: See TracChangeset
for help on using the changeset viewer.