Changeset 10624 for code/trunk/src/orxonox/sound
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/orxonox/sound/AmbientSound.cc
r9939 r10624 36 36 namespace orxonox 37 37 { 38 RegisterAbstractClass(AmbientSound).inheritsFrom<BaseSound>().inheritsFrom<MoodListener>(); 39 38 40 AmbientSound::AmbientSound() 39 41 : bPlayOnLoad_(false) … … 49 51 if (GameMode::playsSound()) 50 52 { 51 // Smoothly fade out by keeping a S martPtr53 // Smoothly fade out by keeping a StrongPtr 52 54 SoundManager::getInstance().unregisterAmbientSound(this); 53 55 } -
code/trunk/src/orxonox/sound/BaseSound.cc
r9939 r10624 43 43 namespace orxonox 44 44 { 45 RegisterAbstractClass(BaseSound).inheritsFrom (Class(Listable));45 RegisterAbstractClass(BaseSound).inheritsFrom<Listable>(); 46 46 47 47 BaseSound::BaseSound() -
code/trunk/src/orxonox/sound/SoundBuffer.h
r6764 r10624 46 46 friend class SoundManager; 47 47 #if !defined(_MSC_VER) || _MSC_VER >= 1500 48 // Make sure nobody deletes an instance (using s martpointers)48 // Make sure nobody deletes an instance (using strong pointers) 49 49 template <class T> 50 50 friend void boost::checked_delete(T*); -
code/trunk/src/orxonox/sound/SoundManager.cc
r9939 r10624 38 38 #include "util/Math.h" 39 39 #include "util/Clock.h" 40 #include " util/ScopedSingletonManager.h"40 #include "core/singleton/ScopedSingletonIncludes.h" 41 41 #include "core/config/ConfigValueIncludes.h" 42 42 #include "core/CoreIncludes.h" … … 50 50 namespace orxonox 51 51 { 52 ManageScopedSingleton(SoundManager, ScopeID::G raphics, true);52 ManageScopedSingleton(SoundManager, ScopeID::GRAPHICS, true); 53 53 54 54 std::string SoundManager::getALErrorString(ALenum code) … … 65 65 } 66 66 } 67 68 RegisterAbstractClass(SoundManager).inheritsFrom<Configurable>().inheritsFrom<UpdateListener>(); 67 69 68 70 SoundManager::SoundManager() … … 163 165 SoundManager::~SoundManager() 164 166 { 165 // Erase fade lists because of the s martpointers167 // Erase fade lists because of the strong pointers 166 168 this->bDestructorCalled_ = true; 167 169 this->fadeInList_.clear(); … … 417 419 } 418 420 419 void SoundManager::fadeIn( const SmartPtr<AmbientSound>&sound)421 void SoundManager::fadeIn(AmbientSound* sound) 420 422 { 421 423 // If we're already fading out --> remove that 422 for (std::list<S martPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)424 for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++) 423 425 { 424 426 if (*it == sound) … … 433 435 } 434 436 435 void SoundManager::fadeOut( const SmartPtr<AmbientSound>&sound)437 void SoundManager::fadeOut(AmbientSound* sound) 436 438 { 437 439 // If we're already fading in --> remove that 438 for (std::list<S martPtr<AmbientSound> >::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)440 for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++) 439 441 { 440 442 if (*it == sound) … … 459 461 460 462 // FADE IN 461 for (std::list<S martPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); )463 for (std::list<StrongPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); ) 462 464 { 463 465 if ((*it)->getVolume() + this->crossFadeStep_*dt > 1.0f) … … 474 476 475 477 // FADE OUT 476 for (std::list<S martPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); )478 for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); ) 477 479 { 478 480 if ((*it)->getVolume() - this->crossFadeStep_*dt < 0.0f) -
code/trunk/src/orxonox/sound/SoundManager.h
r9667 r10624 40 40 #include "util/Singleton.h" 41 41 #include "core/config/Configurable.h" 42 #include "core/object/SmartPtr.h" 42 #include "core/object/StrongPtr.h" 43 #include "core/UpdateListener.h" 43 44 44 45 // tolua_begin … … 59 60 class _OrxonoxExport SoundManager 60 61 // tolua_end 61 : public Singleton<SoundManager>, public Configurable 62 : public Singleton<SoundManager>, public Configurable, public UpdateListener 62 63 { // tolua_export 63 64 friend class Singleton<SoundManager>; … … 68 69 69 70 void preUpdate(const Clock& time); 71 void postUpdate(const Clock& time) { /*no action*/ } 70 72 void setConfigValues(); 71 73 … … 104 106 private: 105 107 void processCrossFading(float dt); 106 void fadeIn( const SmartPtr<AmbientSound>&sound);107 void fadeOut( const SmartPtr<AmbientSound>&sound);108 void fadeIn(AmbientSound* sound); 109 void fadeOut(AmbientSound* sound); 108 110 109 111 void checkFadeStepValidity(); … … 127 129 //! Absolute change per second (0.1 means 10% of the nominal volume) for cross fading 128 130 float crossFadeStep_; 129 std::list<S martPtr<AmbientSound> > fadeInList_;130 std::list<S martPtr<AmbientSound> > fadeOutList_;131 std::list<StrongPtr<AmbientSound> > fadeInList_; 132 std::list<StrongPtr<AmbientSound> > fadeOutList_; 131 133 132 134 // Volume related -
code/trunk/src/orxonox/sound/WorldAmbientSound.cc
r9945 r10624 33 33 #include "core/XMLPort.h" 34 34 #include "AmbientSound.h" 35 #include "core/command/ConsoleCommand .h"35 #include "core/command/ConsoleCommandIncludes.h" 36 36 #include <exception> 37 37
Note: See TracChangeset
for help on using the changeset viewer.