Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6370


Ignore:
Timestamp:
Dec 17, 2009, 11:10:39 AM (14 years ago)
Author:
rgrieder
Message:

Little cleanup in sound stuff and MoodManager.
Caution: Renamed SoundTypes to {All, Music, Effects}!

Location:
code/branches/presentation2
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/data/gui/scripts/AudioMenu.lua

    r6363 r6370  
    1818    musicscrollbar_active = false
    1919    effectsscrollbar_active = false
    20     mastervolume = soundMgr:getVolume(orxonox.SoundType.none)
    21     musicvolume = soundMgr:getVolume(orxonox.SoundType.ambient)
    22     effectsvolume = soundMgr:getVolume(orxonox.SoundType.effects)
    23     mastermute = soundMgr:getMute(orxonox.SoundType.none)
    24     musicmute = soundMgr:getMute(orxonox.SoundType.ambient)
    25     effectsmute = soundMgr:getMute(orxonox.SoundType.effects)
     20    mastervolume = soundMgr:getVolume(orxonox.SoundType.All)
     21    musicvolume = soundMgr:getVolume(orxonox.SoundType.Music)
     22    effectsvolume = soundMgr:getVolume(orxonox.SoundType.Effects)
     23    mastermute = soundMgr:getMute(orxonox.SoundType.All)
     24    musicmute = soundMgr:getMute(orxonox.SoundType.Music)
     25    effectsmute = soundMgr:getMute(orxonox.SoundType.Effects)
    2626    masterscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
    2727    musicscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
     
    131131        end
    132132    end
    133     soundMgr:toggleMute(orxonox.SoundType.none)
     133    soundMgr:toggleMute(orxonox.SoundType.All)
    134134end
    135135
     
    146146        end
    147147    end
    148     soundMgr:toggleMute(orxonox.SoundType.ambient)
     148    soundMgr:toggleMute(orxonox.SoundType.Music)
    149149end
    150150
     
    161161        end
    162162    end
    163     soundMgr:toggleMute(orxonox.SoundType.effects)
     163    soundMgr:toggleMute(orxonox.SoundType.Effects)
    164164end
    165165
  • code/branches/presentation2/src/orxonox/MoodManager.cc

    r6205 r6370  
    4141    {
    4242        RegisterRootObject(MoodManager);
    43         moodOld_ = "default";
    4443        this->setConfigValues();
    4544        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&MoodManager::setMood, this), "setMood"));
     
    5756    }
    5857
    59     /**
    60      *  Sets the mood
    61      *  @note TODO: Inform dependent classes of mood change
    62      */
     58    /** Sets the mood
     59    @note
     60       TODO: Inform dependent classes of mood change
     61    */
    6362    void MoodManager::setMood(const std::string& mood)
    6463    {
     
    6665    }
    6766   
    68     // gets the current mood
     67    //! Gets the current mood
    6968    const std::string& MoodManager::getMood()
    7069    {
     
    7473    void MoodManager::checkMoodValidity()
    7574    {
    76         if(mood_ != "default" && mood_ != "dnb")        // Insert new moods here
    77         {
     75        if (mood_ != "default" && mood_ != "dnb") // Insert new moods here; TODO: make this generic
    7876            ResetConfigValue(mood_);
    79         }
    80         COUT(3) << "MoodManager: Mood now set to " << mood_ << std::endl;
    81         return;
     77        COUT(4) << "MoodManager: Mood set to " << mood_ << std::endl;
    8278    }
    8379}
  • code/branches/presentation2/src/orxonox/MoodManager.h

    r6278 r6370  
    5959
    6060        private:
     61            void checkMoodValidity();
    6162
    6263            // config values
    6364            std::string mood_;
    6465            std::string moodOld_;
    65 
    66             void checkMoodValidity();
    6766
    6867            static MoodManager* singletonPtr_s;
  • code/branches/presentation2/src/orxonox/sound/AmbientSound.cc

    r6349 r6370  
    6767    {
    6868        registerVariable(ambientSource_, ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::ambientSourceChanged));
    69         registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::loopingChanged));
    70         registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::pitchChanged));
    71         registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::stateChanged));
     69        registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::loopingChanged));
     70        registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::pitchChanged));
     71        registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::stateChanged));
    7272    }
    7373
     
    125125    }
    126126   
    127     float AmbientSound::getVolumeGain()
     127    float AmbientSound::getRealVolume()
    128128    {
    129129        assert(GameMode::playsSound());
    130         return SoundManager::getInstance().getVolume(SoundType::ambient);
     130        return SoundManager::getInstance().getRealVolume(SoundType::Music);
    131131    }
    132132
  • code/branches/presentation2/src/orxonox/sound/AmbientSound.h

    r6349 r6370  
    5959        void stop();
    6060        void pause();
    61        
    62         float getVolumeGain();
    6361
    6462        void setAmbientSource(const std::string& source);
     
    7169        void doStop();
    7270        void doPause();
    73        
    7471        void registerVariables();
     72        float getRealVolume();
    7573
    7674        std::string ambientSource_; //!< Analogous to source_, but mood independent
  • code/branches/presentation2/src/orxonox/sound/BaseSound.cc

    r6340 r6370  
    145145    void BaseSound::setVolume(float vol)
    146146    {
    147         if (vol > 1 || vol < 0)
    148         {
    149             COUT(2) << "Sound warning: volume out of range, cropping value." << std::endl;
    150             vol = vol > 1 ? 1 : vol;
    151             vol = vol < 0 ? 0 : vol;
    152         }
    153         this->volume_ = vol;
    154        
     147        this->volume_ = clamp(vol, 0.0f, 1.0f);
     148        if (this->volume_ != vol)
     149            COUT(2) << "Sound warning: volume out of range, clamping value." << std::endl;
    155150        this->updateVolume();
    156151    }
    157152   
    158     float BaseSound::getVolumeGain()
    159     {
    160         assert(GameMode::playsSound());
    161         return SoundManager::getInstance().getVolume(SoundType::none);
    162     }
    163    
    164     void BaseSound::updateVolume(void)
    165     {
    166         if (alIsSource(this->audioSource_))
    167         {
    168             float volume = this->volume_ * this->getVolumeGain();
     153    void BaseSound::updateVolume()
     154    {
     155        if (alIsSource(this->audioSource_))
     156        {
     157            float volume = this->volume_ * this->getRealVolume();
    169158            alSourcef(this->audioSource_, AL_GAIN, volume);
    170159            if (int error = alGetError())
  • code/branches/presentation2/src/orxonox/sound/BaseSound.h

    r6322 r6370  
    6767
    6868        virtual void setSource(const std::string& source);
    69         virtual const std::string& getSource() const { return this->source_; }
    70         inline void sourceChanged(){ this->setSource(this->source_); }
     69        virtual const std::string& getSource() const
     70            { return this->source_; }
    7171
    7272        void setVolume(float vol);
    73         float getVolume() const { return this->volume_; }
    74         inline void volumeChanged(){ this->setVolume(this->volume_); }
    75        
    76         virtual float getVolumeGain();
    77         void updateVolume(void);
     73        float getVolume() const
     74            { return this->volume_; }
     75        void updateVolume();
    7876
    79         bool getLooping() const   { return this->bLooping_; }
     77        bool getLooping() const
     78            { return this->bLooping_; }
    8079        void setLooping(bool val);
    81         inline void loopingChanged(){ this->setLooping(this->bLooping_); }
    8280
    83         float getPitch() const   { return this->pitch_; }
     81        float getPitch() const
     82            { return this->pitch_; }
    8483        void setPitch(float pitch);
    85         inline void pitchChanged(){ this->setPitch(this->pitch_); }
    86        
    87         void stateChanged();
    88 
    89         //ALuint getALAudioSource(void);
    9084
    9185    protected:
     
    9690            Paused
    9791        };
     92
     93        // network callbacks
     94        inline void pitchChanged()
     95            { this->setPitch(this->pitch_); }
     96        inline void loopingChanged()
     97            { this->setLooping(this->bLooping_); }
     98        inline void volumeChanged()
     99            { this->setVolume(this->volume_); }
     100        inline void sourceChanged()
     101            { this->setSource(this->source_); }
     102        void stateChanged();
     103
    98104        virtual void initialiseSource();
    99105        ALint getSourceState() const;
     106
     107        virtual float getRealVolume() = 0;
    100108
    101109        ALuint          audioSource_;
  • code/branches/presentation2/src/orxonox/sound/SoundManager.cc

    r6349 r6370  
    5151    ManageScopedSingleton(SoundManager, ScopeID::Graphics, true);
    5252
     53    std::string SoundManager::getALErrorString(ALenum code)
     54    {
     55        switch (code)
     56        {
     57        case AL_NO_ERROR:          return "No error";
     58        case AL_INVALID_NAME:      return "Invalid AL parameter name";
     59        case AL_INVALID_ENUM:      return "Invalid AL enum";
     60        case AL_INVALID_VALUE:     return "Invalid AL value";
     61        case AL_INVALID_OPERATION: return "Invalid AL operation";
     62        case AL_OUT_OF_MEMORY:     return "AL reports out of memory";
     63        default:                   return "Unknown AL error";
     64        }
     65    }
     66
    5367    SoundManager::SoundManager()
    5468        : effectsPoolSize_(0)
     
    114128            COUT(2) << "Sound Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl;
    115129       
    116         this->setVolumeInternal(1.0, SoundType::none);
    117         this->setVolumeInternal(1.0, SoundType::ambient);
    118         this->setVolumeInternal(1.0, SoundType::effects);
    119        
    120         this->mute_[SoundType::none] = false;
    121         this->mute_[SoundType::ambient] = false;
    122         this->mute_[SoundType::effects] = false;
     130        this->mute_[SoundType::All]     = 1.0f;
     131        this->mute_[SoundType::Music]   = 1.0f;
     132        this->mute_[SoundType::Effects] = 1.0f;
    123133
    124134        this->setConfigValues();
     
    186196            .callback(this, &SoundManager::checkFadeStepValidity);
    187197
    188         SetConfigValue(soundVolume_, 1.0f)
     198        SetConfigValueAlias(volume_[SoundType::All], "soundVolume_", 1.0f)
    189199            .description("Defines the overall volume.")
    190200            .callback(this, &SoundManager::checkSoundVolumeValidity);
    191 
    192         SetConfigValue(ambientVolume_, 1.0f)
     201        SetConfigValueAlias(volume_[SoundType::Music], "ambientVolume_", 1.0f)
    193202            .description("Defines the ambient volume.")
    194203            .callback(this, &SoundManager::checkAmbientVolumeValidity);
    195 
    196         SetConfigValue(effectsVolume_, 1.0f)
     204        SetConfigValueAlias(volume_[SoundType::Effects], "effectsVolume_", 1.0f)
    197205            .description("Defines the effects volume.")
    198206            .callback(this, &SoundManager::checkEffectsVolumeValidity);
     
    202210    }
    203211
    204     std::string SoundManager::getALErrorString(ALenum code)
    205     {
    206         switch (code)
    207         {
    208         case AL_NO_ERROR:          return "No error";
    209         case AL_INVALID_NAME:      return "Invalid AL parameter name";
    210         case AL_INVALID_ENUM:      return "Invalid AL enum";
    211         case AL_INVALID_VALUE:     return "Invalid AL value";
    212         case AL_INVALID_OPERATION: return "Invalid AL operation";
    213         case AL_OUT_OF_MEMORY:     return "AL reports out of memory";
    214         default:                   return "Unknown AL error";
    215         }
    216     }
    217 
    218212    void SoundManager::checkFadeStepValidity()
    219213    {
    220214        if (crossFadeStep_ <= 0.0 || crossFadeStep_ >= 1.0 )
    221215        {
    222             COUT(2) << "Sound warning: Sound step out of range, ignoring change." << std::endl;
     216            COUT(2) << "Sound warning: fade step out of range, ignoring change." << std::endl;
    223217            ResetConfigValue(crossFadeStep_);
    224218        }
    225         COUT(3) << "SoundManager: fade step set to " << crossFadeStep_ << std::endl;
    226         return;
    227     }
    228    
    229     bool SoundManager::checkVolumeValidity(SoundType::Value type)
    230     {
    231         bool valid = true;
    232        
    233         if(this->getVolumeInternal(type) < 0.0 || this->getVolumeInternal(type) > 1.0)
    234         {
    235             COUT(2) << "Sound warning: Sound volume out of range, ignoring change." << std::endl;
    236             valid = false;
    237         }
    238        
     219    }
     220
     221    void SoundManager::checkVolumeValidity(SoundType::Value type)
     222    {
     223        float clampedVolume = clamp(this->volume_[type], 0.0f, 1.0f);
     224        if (clampedVolume != this->volume_[type])
     225            COUT(2) << "Sound warning: Volume setting (" << type << ") out of range, clamping." << std::endl;
    239226        this->updateVolume(type);
    240         COUT(4) << "SoundManager: volume set to " << this->getVolumeInternal(type) << std::endl;
    241         return valid;
    242     }
    243    
    244     void SoundManager::checkSoundVolumeValidity()
    245     {
    246         if(!checkVolumeValidity(SoundType::none))
    247         {
    248             ResetConfigValue(soundVolume_);
    249         }
    250     }
    251    
    252     void SoundManager::checkAmbientVolumeValidity()
    253     {
    254         if(!checkVolumeValidity(SoundType::ambient))
    255         {
    256             ResetConfigValue(ambientVolume_);
    257         }
    258     }
    259    
    260     void SoundManager::checkEffectsVolumeValidity()
    261     {
    262         if(!checkVolumeValidity(SoundType::effects))
    263         {
    264             ResetConfigValue(effectsVolume_);
    265         }
     227    }
     228
     229    void SoundManager::setVolume(float vol, SoundType::Value type)
     230    {
     231        if (type < 0 || type > SoundType::Effects)
     232            return;
     233        this->volume_[type] = vol;
     234        this->checkVolumeValidity(type);
     235    }
     236
     237    float SoundManager::getVolume(SoundType::Value type)
     238    {
     239        if (type < 0 || type > SoundType::Effects)
     240            return 0.0f;
     241        return this->volume_[type];
     242    }
     243
     244    float SoundManager::getRealVolume(SoundType::Value type)
     245    {
     246        if (type != SoundType::Music && type != SoundType::Effects)
     247            return 0.0f;
     248        return this->volume_[SoundType::All] * this->mute_[SoundType::All] * this->volume_[type] * this->mute_[type];
     249    }
     250
     251    void SoundManager::updateVolume(SoundType::Value type)
     252    {
     253        switch(type)
     254        {
     255        case SoundType::All:
     256            for (ObjectList<BaseSound>::iterator it = ObjectList<BaseSound>::begin(); it != ObjectList<BaseSound>::end(); ++it)
     257                (*it)->updateVolume();
     258            break;
     259        case SoundType::Music:
     260            for (ObjectList<AmbientSound>::iterator it = ObjectList<AmbientSound>::begin(); it != ObjectList<AmbientSound>::end(); ++it)
     261                (*it)->updateVolume();
     262            break;
     263        case SoundType::Effects:
     264            for (ObjectList<WorldSound>::iterator it = ObjectList<WorldSound>::begin(); it != ObjectList<WorldSound>::end(); ++it)
     265                (*it)->updateVolume();
     266            break;
     267        default:
     268            assert(false);
     269        }
     270    }
     271
     272    void SoundManager::toggleMute(SoundType::Value type)
     273    {
     274        if (type < 0 || type > SoundType::Effects)
     275            return;
     276        this->mute_[type] = (this->mute_[type] == 0) ? 1.0f : 0.0f;
     277        this->updateVolume(type);
     278    }
     279
     280    bool SoundManager::getMute(SoundType::Value type)
     281    {
     282        if (type < 0 || type > SoundType::Effects)
     283            return true;
     284        return (this->mute_[type] == 0);
    266285    }
    267286
     
    358377        }
    359378    }
    360    
    361    
    362     void SoundManager::setVolume(float vol, SoundType::Value type)
    363     {
    364         vol = this->checkVolumeRange(vol);
    365        
    366         this->setVolumeInternal(vol, type);
    367        
    368         this->updateVolume(type);
    369     }
    370    
    371     float SoundManager::checkVolumeRange(float vol)
    372     {
    373         if(vol < 0.0 || vol > 1.0)
    374         {
    375             COUT(2) << "Sound warning: volume out of range, cropping value." << std::endl;
    376             vol = vol > 1 ? 1 : vol;
    377             vol = vol < 0 ? 0 : vol;
    378         }
    379        
    380         return vol;
    381     }
    382    
    383     void SoundManager::updateVolume(SoundType::Value type)
    384     {
    385         switch(type)
    386         {
    387             case SoundType::none:
    388                 for (ObjectList<BaseSound>::iterator it = ObjectList<BaseSound>::begin(); it != ObjectList<BaseSound>::end(); ++it)
    389                 {
    390                     (*it)->updateVolume();
    391                 }
    392                 break;
    393             case SoundType::ambient:
    394                 for (ObjectList<AmbientSound>::iterator it = ObjectList<AmbientSound>::begin(); it != ObjectList<AmbientSound>::end(); ++it)
    395                 {
    396                     (*it)->updateVolume();
    397                 }
    398                 break;
    399             case SoundType::effects:
    400                 for (ObjectList<WorldSound>::iterator it = ObjectList<WorldSound>::begin(); it != ObjectList<WorldSound>::end(); ++it)
    401                 {
    402                     (*it)->updateVolume();
    403                 }
    404                 break;
    405             default:
    406                 COUT(2) << "Invalid SoundType in SoundManager::updateVolume() - Not updating!" << std::endl;
    407         }
    408     }
    409    
    410     void SoundManager::setVolumeInternal(float vol, SoundType::Value type)
    411     {
    412         switch(type)
    413         {
    414             case SoundType::none:
    415                 this->soundVolume_ = vol;
    416                 break;
    417             case SoundType::ambient:
    418                 this->ambientVolume_ = vol;
    419                 break;
    420             case SoundType::effects:
    421                 this->effectsVolume_ = vol;
    422                 break;
    423             default:
    424                 COUT(2) << "Invalid SoundType in SoundManager::setVolumeInternal() - Not setting any volume!" << std::endl;
    425         }
    426     }
    427    
    428     float SoundManager::getVolumeInternal(SoundType::Value type)
    429     {
    430         switch(type)
    431         {
    432             case SoundType::none:
    433                 return this->soundVolume_;
    434             case SoundType::ambient:
    435                 return this->ambientVolume_;
    436             case SoundType::effects:
    437                 return this->effectsVolume_;
    438             default:
    439                 COUT(2) << "Invalid SoundType in SoundManager::setVolumeInternal() - Returning 0.0!" << std::endl;
    440                 return 0.0;
    441         }
    442     }
    443    
    444     float SoundManager::getVolume(SoundType::Value type)
    445     {
    446         if(this->mute_[SoundType::none] || this->mute_[type])
    447             return 0.0;
    448        
    449         if(type == SoundType::none)
    450             return this->getVolumeInternal(type);
    451        
    452         return this->getVolumeInternal(SoundType::none)*this->getVolumeInternal(type);
    453     }
    454    
    455     void SoundManager::toggleMute(SoundType::Value type)
    456     {
    457         bool mute = !this->mute_[type];
    458         this->mute_[type] = mute;
    459        
    460         this->updateVolume(type);
    461     }
    462    
    463     bool SoundManager::getMute(SoundType::Value type)
    464     {
    465         return this->mute_[type];
    466     }
    467    
    468379
    469380    void SoundManager::fadeIn(const SmartPtr<AmbientSound>& sound)
  • code/branches/presentation2/src/orxonox/sound/SoundManager.h

    r6349 r6370  
    5050    // forward declaration
    5151    class SoundBuffer;
    52    
     52
    5353    //! Enum for the sound type.
    5454    namespace SoundType
     
    5656        enum Value
    5757        {
    58             none,
    59             ambient,
    60             effects
     58            All     = 0,
     59            Music   = 1,
     60            Effects = 2
    6161        };
    6262    }
    63    
    64     /**
    65      * The SoundManager class manages the OpenAL device, context and listener
    66      * position. It is a singleton.
    67      *
    68      */
     63
     64    //! The SoundManager class manages the OpenAL device, context and listener position.
    6965    class _OrxonoxExport SoundManager
    7066    // tolua_end
     
    9490        void pauseAmbientSound(AmbientSound* ambient);
    9591
     92        // tolua_begin
    9693        void setVolume(float vol, SoundType::Value type);
    97         float getVolume(SoundType::Value type); // tolua_export
     94        float getVolume(SoundType::Value type);
     95        float getRealVolume(SoundType::Value type);
    9896
    99         void toggleMute(SoundType::Value type); // tolua_export
    100         bool getMute(SoundType::Value type); // tolua_export
     97        void toggleMute(SoundType::Value type);
     98        bool getMute(SoundType::Value type);
     99        // tolua_end
    101100
    102101        shared_ptr<SoundBuffer> getSoundBuffer(const std::string& filename);
     
    114113
    115114        void checkFadeStepValidity();
    116         bool checkVolumeValidity(SoundType::Value type);
    117         void checkSoundVolumeValidity(void);
    118         void checkAmbientVolumeValidity(void);
    119         void checkEffectsVolumeValidity(void);
    120115
    121         float checkVolumeRange(float vol);
    122 
     116        void checkVolumeValidity(SoundType::Value type);
     117        void checkSoundVolumeValidity()   { this->checkVolumeValidity(SoundType::All); }
     118        void checkAmbientVolumeValidity() { this->checkVolumeValidity(SoundType::Music); }
     119        void checkEffectsVolumeValidity() { this->checkVolumeValidity(SoundType::Effects); }
    123120        void updateVolume(SoundType::Value type);
    124121
    125         void setVolumeInternal(float vol, SoundType::Value type);
    126         float getVolumeInternal(SoundType::Value type);
    127 
     122        // OpenAL device/context related
    128123        std::vector<std::string> deviceNames_;
    129124        ALCdevice* device_;
    130125        ALCcontext* context_;
    131126
     127        // Ambient sound related
    132128        typedef std::list<std::pair<AmbientSound*, bool> > AmbientList;
    133         AmbientList ambientSounds_;
    134 
    135         float crossFadeStep_;       //!< Absolute change per second (0.1 means 10% of the nominal volume) for cross fading
     129        AmbientList                        ambientSounds_;
     130        //! Absolute change per second (0.1 means 10% of the nominal volume) for cross fading
     131        float                              crossFadeStep_;
    136132        std::list<SmartPtr<AmbientSound> > fadeInList_;
    137133        std::list<SmartPtr<AmbientSound> > fadeOutList_;
    138134
    139         float soundVolume_;
    140         float ambientVolume_;
    141         float effectsVolume_;
    142         std::map<SoundType::Value, bool> mute_;
     135        // Volume related
     136        float volume_[3];
     137        float mute_[3];
    143138
     139        // Sound buffer related
    144140        static const unsigned int maxEffectsPoolSize_s = 40 * 1024 * 1024;
    145141        unsigned int effectsPoolSize_;
     
    149145        SoundBufferMap soundBuffers_;
    150146
     147        // Sound source related
    151148        unsigned int maxSources_;
    152149        std::vector<ALuint> soundSources_;
  • code/branches/presentation2/src/orxonox/sound/WorldSound.cc

    r6322 r6370  
    5757    void WorldSound::registerVariables()
    5858    {
    59         registerVariable(volume_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::volumeChanged));
    60         registerVariable(source_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::sourceChanged));
    61         registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::loopingChanged));
    62         registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::stateChanged));
    63         registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::pitchChanged));
     59        registerVariable(volume_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::volumeChanged));
     60        registerVariable(source_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::sourceChanged));
     61        registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::loopingChanged));
     62        registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::stateChanged));
     63        registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::pitchChanged));
    6464    }
    6565
     
    115115    }
    116116
    117     float WorldSound::getVolumeGain()
     117    float WorldSound::getRealVolume()
    118118    {
    119         return SoundManager::getInstance().getVolume(SoundType::effects);
     119        return SoundManager::getInstance().getRealVolume(SoundType::Effects);
    120120    }
    121121}
  • code/branches/presentation2/src/orxonox/sound/WorldSound.h

    r6322 r6370  
    4646    public:
    4747        WorldSound(BaseObject* creator);
    48         virtual ~WorldSound();
     48        ~WorldSound();
    4949
    50         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    51         virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    52         virtual void changedActivity();
    53        
    54         virtual float getVolumeGain();
     50        void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     51        void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     52        void changedActivity();
    5553
    56         virtual void tick(float dt);
     54        void tick(float dt);
    5755
    5856    private:
    5957        void registerVariables();
    6058        void initialiseSource();
     59        float getRealVolume();
    6160    };
    6261}
Note: See TracChangeset for help on using the changeset viewer.