Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 15, 2009, 3:43:06 PM (16 years ago)
Author:
rgrieder
Message:

Detail changes in the sound classes.
Plus fixed the level sound problem (order of XML parameters was wrong).
There is still a large issue when changing an ambient sound source though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound3/src/orxonox/sound/SoundManager.h

    r6046 r6069  
    2222 *   Author:
    2323 *       Erwin 'vaiursch' Herrsche
     24 *       Kevin Young
    2425 *   Co-authors:
    2526 *      ...
    2627 */
     28
    2729#ifndef _SoundManager_H__
    2830#define _SoundManager_H__
     
    3032#include "OrxonoxPrereqs.h"
    3133
    32 #include <cassert>
    3334#include <list>
     35#include <string>
    3436#include "util/Singleton.h"
    35 #include "tools/interfaces/Tickable.h"
    3637
    3738namespace orxonox
     
    4546    {
    4647        friend class Singleton<SoundManager>;
     48
    4749    public:
    4850        SoundManager();
    4951        ~SoundManager();
    5052
    51         void update(const Clock &time);
    52         void setConfigValues(void);
     53        void update(const Clock& time);
     54        void setConfigValues();
    5355
    5456        void setListenerPosition(const Vector3& position);
     
    5658
    5759        void registerAmbientSound(AmbientSound* newAmbient);
    58         void unregisterAmbientSound(AmbientSound* currentAmbient);
    59         const std::string& getAmbientPath(const std::string& source);
    60         void fadeInAmbientSound(float dt);
    61         void fadeOutAmbientSound(float dt);
    62         void checkFadeStepValidity(void);
     60        void unregisterAmbientSound(AmbientSound* oldAmbient);
     61        void pauseAmbientSound(AmbientSound* ambient);
     62        std::string getAmbientPath(const std::string& source);
    6363
    6464    private:
     65        void processCrossFading(float dt);
     66        void fadeIn(AmbientSound* sound);
     67        void fadeOut(AmbientSound* sound);
     68
     69        void checkFadeStepValidity();
     70
    6571        ALCdevice* device_;
    6672        ALCcontext* context_;
    6773       
    68         std::list<AmbientSound*> ambientSounds_;
     74        typedef std::list<std::pair<AmbientSound*, bool> > AmbientList;
     75        AmbientList ambientSounds_;
    6976       
    70         float fadeStep_;       //per second
    71         std::list<std::pair<AmbientSound*, float> > fadeInList_;
    72         std::list<std::pair<AmbientSound*, float> > fadeOutList_;
     77        float crossFadeStep_;       //!< Absolute change per second (0.1 means 10% of the nominal volume) for cross fading
     78        std::list<AmbientSound*> fadeInList_;
     79        std::list<AmbientSound*> fadeOutList_;
    7380       
    74         std::string lastReqPath_;
    75 
    7681        static SoundManager* singletonPtr_s;
    7782    };
Note: See TracChangeset for help on using the changeset viewer.