Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/sound4/src/orxonox/sound/AmbientSound.h @ 6577

Last change on this file since 6577 was 6504, checked in by erwin, 15 years ago

Commit before rebase, attempt to fix everything ;-)

  • Property svn:eol-style set to native
File size: 2.8 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:
[5896]23 *      Reto Grieder
[6417]24 *      Kevin Young
[3060]25 *   Co-authors:
26 *      ...
27 *
28 */
[6417]29
[5896]30#ifndef _AmbientSound_H__
31#define _AmbientSound_H__
[3060]32
[6476]33#include <boost/thread.hpp>
34
[6435]35#include "sound/SoundPrereqs.h"
[3060]36
[5896]37#include "core/BaseObject.h"
[6417]38#include "network/synchronisable/Synchronisable.h"
39#include "BaseSound.h"
40#include "MoodManager.h"
[5896]41
[3060]42namespace orxonox
43{
44    /**
[5896]45     * The AmbientSound class is the base class for all sound file loader classes.
[3060]46     * It server as main interface to the OpenAL library.
47     *
48     */
[6417]49    class _OrxonoxExport AmbientSound : public BaseSound, public BaseObject, public Synchronisable, public MoodListener
[3060]50    {
[6417]51        friend class SoundManager;
52
[3060]53    public:
[5896]54        AmbientSound(BaseObject* creator);
[3060]55
[6417]56        void XMLPort(Element& xmlelement, XMLPort::Mode mode);
57        void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
58        void changedActivity();
[3060]59
[6417]60        void play();
61        void stop();
62        void pause();
63
64        void setAmbientSource(const std::string& source);
65        inline const std::string& getAmbientSource() const
66            { return this->ambientSource_; }
67
68        void setPlayOnLoad(bool val);
69        bool getPlayOnLoad() const
70            { return this->bPlayOnLoad_; }
71
72    protected:
73        ~AmbientSound() { }
74
[6504]75        void doPlay();
76        void doStop();
77
[3060]78    private:
[6417]79        void preDestroy();
80        void registerVariables();
81        float getRealVolume();
82        void moodChanged(const std::string& mood);
83        inline void ambientSourceChanged()
84            { this->setAmbientSource(this->ambientSource_); }
85        inline void playOnLoadChanged()
86            { this->setPlayOnLoad(this->bPlayOnLoad_); }
87
88        std::string ambientSource_; //!< Analogous to source_, but mood independent
89        bool        bPlayOnLoad_;   //!< Play the sound immediately when loaded
[6476]90
91        boost::thread soundstreamthread_; // hacky solution for streaming
92        void setStreamSource(const std::string& source);
[5896]93    };
94}
[3060]95
[5896]96#endif /* _AmbientSound_H__ */
Note: See TracBrowser for help on using the repository browser.