Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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}!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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_;
Note: See TracChangeset for help on using the changeset viewer.