Changeset 7854 for code/trunk/src/orxonox/sound/AmbientSound.cc
- Timestamp:
- Feb 11, 2011, 1:03:47 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.