Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 23, 2009, 8:45:56 PM (14 years ago)
Author:
rgrieder
Message:

Mood changes should now be working and with immediate (but delayed because of loading) effect.

Location:
code/branches/presentation2/src/orxonox/sound
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/sound/AmbientSound.cc

    r6394 r6406  
    3535#include "core/XMLPort.h"
    3636#include "SoundManager.h"
    37 #include "MoodManager.h"
    3837
    3938namespace orxonox
     
    111110    {
    112111        this->ambientSource_ = source;
     112        this->moodChanged(this->getMood());
     113    }
     114
     115    void AmbientSound::moodChanged(const std::string& mood)
     116    {
    113117        if (GameMode::playsSound())
    114118        {
    115             const std::string& path = "ambient/" + MoodManager::getInstance().getMood() + '/' + source;
     119            const std::string& path = "ambient/" + MoodManager::getInstance().getMood() + '/' + this->ambientSource_;
    116120            shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);
    117121            if (fileInfo != NULL)
    118122                this->setSource(path);
    119123            else
    120                 COUT(3) << "Sound: " << source << ": Not a valid name! Ambient sound will not change." << std::endl;
     124                COUT(3) << "Sound: " << this->ambientSource_ << ": Not a valid name! Ambient sound will not change." << std::endl;
    121125        }
    122126    }
  • code/branches/presentation2/src/orxonox/sound/AmbientSound.h

    r6382 r6406  
    3434
    3535#include "core/BaseObject.h"
    36 #include "sound/BaseSound.h"
    3736#include "network/synchronisable/Synchronisable.h"
     37#include "BaseSound.h"
     38#include "MoodManager.h"
    3839
    3940namespace orxonox
     
    4445     *
    4546     */
    46     class _OrxonoxExport AmbientSound : public BaseSound, public BaseObject, public Synchronisable
     47    class _OrxonoxExport AmbientSound : public BaseSound, public BaseObject, public Synchronisable, public MoodListener
    4748    {
    4849        friend class SoundManager;
     
    7475        void registerVariables();
    7576        float getRealVolume();
     77        void moodChanged(const std::string& mood);
    7678        inline void ambientSourceChanged()
    7779            { this->setAmbientSource(this->ambientSource_); }
Note: See TracChangeset for help on using the changeset viewer.