Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 9:12:21 PM (9 years ago)
Author:
landauf
Message:

merged branch core7 back to trunk

Location:
code/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/sound/AmbientSound.cc

    r9939 r10624  
    3636namespace orxonox
    3737{
     38    RegisterAbstractClass(AmbientSound).inheritsFrom<BaseSound>().inheritsFrom<MoodListener>();
     39
    3840    AmbientSound::AmbientSound()
    3941        : bPlayOnLoad_(false)
     
    4951        if (GameMode::playsSound())
    5052        {
    51             // Smoothly fade out by keeping a SmartPtr
     53            // Smoothly fade out by keeping a StrongPtr
    5254            SoundManager::getInstance().unregisterAmbientSound(this);
    5355        }
  • code/trunk/src/orxonox/sound/BaseSound.cc

    r9939 r10624  
    4343namespace orxonox
    4444{
    45     RegisterAbstractClass(BaseSound).inheritsFrom(Class(Listable));
     45    RegisterAbstractClass(BaseSound).inheritsFrom<Listable>();
    4646
    4747    BaseSound::BaseSound()
  • code/trunk/src/orxonox/sound/SoundBuffer.h

    r6764 r10624  
    4646        friend class SoundManager;
    4747#if !defined(_MSC_VER) || _MSC_VER >= 1500
    48         // Make sure nobody deletes an instance (using smart pointers)
     48        // Make sure nobody deletes an instance (using strong pointers)
    4949        template <class T>
    5050        friend void boost::checked_delete(T*);
  • code/trunk/src/orxonox/sound/SoundManager.cc

    r9939 r10624  
    3838#include "util/Math.h"
    3939#include "util/Clock.h"
    40 #include "util/ScopedSingletonManager.h"
     40#include "core/singleton/ScopedSingletonIncludes.h"
    4141#include "core/config/ConfigValueIncludes.h"
    4242#include "core/CoreIncludes.h"
     
    5050namespace orxonox
    5151{
    52     ManageScopedSingleton(SoundManager, ScopeID::Graphics, true);
     52    ManageScopedSingleton(SoundManager, ScopeID::GRAPHICS, true);
    5353
    5454    std::string SoundManager::getALErrorString(ALenum code)
     
    6565        }
    6666    }
     67
     68    RegisterAbstractClass(SoundManager).inheritsFrom<Configurable>().inheritsFrom<UpdateListener>();
    6769
    6870    SoundManager::SoundManager()
     
    163165    SoundManager::~SoundManager()
    164166    {
    165         // Erase fade lists because of the smart pointers
     167        // Erase fade lists because of the strong pointers
    166168        this->bDestructorCalled_ = true;
    167169        this->fadeInList_.clear();
     
    417419    }
    418420
    419     void SoundManager::fadeIn(const SmartPtr<AmbientSound>& sound)
     421    void SoundManager::fadeIn(AmbientSound* sound)
    420422    {
    421423        // If we're already fading out --> remove that
    422         for (std::list<SmartPtr<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++)
    423425        {
    424426            if (*it == sound)
     
    433435    }
    434436
    435     void SoundManager::fadeOut(const SmartPtr<AmbientSound>& sound)
     437    void SoundManager::fadeOut(AmbientSound* sound)
    436438    {
    437439        // If we're already fading in --> remove that
    438         for (std::list<SmartPtr<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++)
    439441        {
    440442            if (*it == sound)
     
    459461
    460462        // FADE IN
    461         for (std::list<SmartPtr<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(); )
    462464        {
    463465            if ((*it)->getVolume() + this->crossFadeStep_*dt > 1.0f)
     
    474476
    475477        // FADE OUT
    476         for (std::list<SmartPtr<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(); )
    477479        {
    478480            if ((*it)->getVolume() - this->crossFadeStep_*dt < 0.0f)
  • code/trunk/src/orxonox/sound/SoundManager.h

    r9667 r10624  
    4040#include "util/Singleton.h"
    4141#include "core/config/Configurable.h"
    42 #include "core/object/SmartPtr.h"
     42#include "core/object/StrongPtr.h"
     43#include "core/UpdateListener.h"
    4344
    4445// tolua_begin
     
    5960    class _OrxonoxExport SoundManager
    6061    // tolua_end
    61         : public Singleton<SoundManager>, public Configurable
     62        : public Singleton<SoundManager>, public Configurable, public UpdateListener
    6263    { // tolua_export
    6364        friend class Singleton<SoundManager>;
     
    6869
    6970        void preUpdate(const Clock& time);
     71        void postUpdate(const Clock& time) { /*no action*/ }
    7072        void setConfigValues();
    7173
     
    104106    private:
    105107        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);
    108110
    109111        void checkFadeStepValidity();
     
    127129        //! Absolute change per second (0.1 means 10% of the nominal volume) for cross fading
    128130        float                              crossFadeStep_;
    129         std::list<SmartPtr<AmbientSound> > fadeInList_;
    130         std::list<SmartPtr<AmbientSound> > fadeOutList_;
     131        std::list<StrongPtr<AmbientSound> > fadeInList_;
     132        std::list<StrongPtr<AmbientSound> > fadeOutList_;
    131133
    132134        // Volume related
  • code/trunk/src/orxonox/sound/WorldAmbientSound.cc

    r9945 r10624  
    3333#include "core/XMLPort.h"
    3434#include "AmbientSound.h"
    35 #include "core/command/ConsoleCommand.h"
     35#include "core/command/ConsoleCommandIncludes.h"
    3636#include <exception>
    3737
Note: See TracChangeset for help on using the changeset viewer.