Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation2/src/orxonox/sound/AmbientSound.h @ 6322

Last change on this file since 6322 was 6322, checked in by rgrieder, 14 years ago

Added audio source management. This should reduce the problems when loading too many sounds.
However if there are too many players shooting at the same time, some sounds may still not play.

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
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 *      Reto Grieder
24 *      Kevin Young
25 *   Co-authors:
26 *      ...
27 *
28 */
29
30#ifndef _AmbientSound_H__
31#define _AmbientSound_H__
32
33#include "OrxonoxPrereqs.h"
34
35#include "core/BaseObject.h"
36#include "sound/BaseSound.h"
37#include "network/synchronisable/Synchronisable.h"
38
39namespace orxonox
40{
41    /**
42     * The AmbientSound class is the base class for all sound file loader classes.
43     * It server as main interface to the OpenAL library.
44     *
45     */
46    class _OrxonoxExport AmbientSound : public BaseSound, public BaseObject, public Synchronisable
47    {
48        friend class SoundManager;
49
50    public:
51        AmbientSound(BaseObject* creator);
52        ~AmbientSound();
53
54        void XMLPort(Element& xmlelement, XMLPort::Mode mode);
55        void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
56        void changedActivity();
57
58        void play();
59        void stop();
60        void pause();
61       
62        float getVolumeGain();
63
64        void setAmbientSource(const std::string& source);
65        const std::string& getAmbientSource() const { return this->ambientSource_; }
66        inline void ambientSourceChanged(){ this->setAmbientSource(this->ambientSource_); }
67
68    private:
69        void doPlay();
70        void doStop();
71        void doPause();
72       
73        void registerVariables();
74
75        std::string ambientSource_; //!< Analogous to source_, but mood independent
76    };
77}
78
79#endif /* _AmbientSound_H__ */
Note: See TracBrowser for help on using the repository browser.