Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation2/src/orxonox/sound/SoundManager.h @ 6182

Last change on this file since 6182 was 6117, checked in by rgrieder, 15 years ago

Merged sound3 branch to presentation2.

  • Property svn:eol-style set to native
File size: 2.5 KB
RevLine 
[3060]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *       Erwin 'vaiursch' Herrsche
[6117]24 *       Kevin Young
[3060]25 *   Co-authors:
26 *      ...
27 */
[6117]28
[3196]29#ifndef _SoundManager_H__
30#define _SoundManager_H__
[3060]31
32#include "OrxonoxPrereqs.h"
33
[3196]34#include <list>
[6117]35#include <string>
[3370]36#include "util/Singleton.h"
[3196]37
[3060]38namespace orxonox
39{
40    /**
41     * The SoundManager class manages the OpenAL device, context and listener
[5929]42     * position. It is a singleton.
[3060]43     *
44     */
[6117]45    class _OrxonoxExport SoundManager : public Singleton<SoundManager>, public OrxonoxClass
[3060]46    {
[3370]47        friend class Singleton<SoundManager>;
[6117]48
[3060]49    public:
50        SoundManager();
51        ~SoundManager();
52
[6117]53        void update(const Clock& time);
54        void setConfigValues();
55
[5929]56        void setListenerPosition(const Vector3& position);
57        void setListenerOrientation(const Quaternion& orientation);
58
[6117]59        void registerAmbientSound(AmbientSound* newAmbient);
60        void unregisterAmbientSound(AmbientSound* oldAmbient);
61        void pauseAmbientSound(AmbientSound* ambient);
62
[3060]63    private:
[6117]64        void processCrossFading(float dt);
65        void fadeIn(AmbientSound* sound);
66        void fadeOut(AmbientSound* sound);
67
68        void checkFadeStepValidity();
69
[3280]70        ALCdevice* device_;
[3060]71        ALCcontext* context_;
[6117]72       
73        typedef std::list<std::pair<AmbientSound*, bool> > AmbientList;
74        AmbientList ambientSounds_;
75       
76        float crossFadeStep_;       //!< Absolute change per second (0.1 means 10% of the nominal volume) for cross fading
77        std::list<AmbientSound*> fadeInList_;
78        std::list<AmbientSound*> fadeOutList_;
79       
[3370]80        static SoundManager* singletonPtr_s;
[5929]81    };
82}
[3060]83
[3196]84#endif /* _SoundManager_H__ */
Note: See TracBrowser for help on using the repository browser.