| [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 |  | 
|---|
 | 33 | #include "OrxonoxPrereqs.h" | 
|---|
 | 34 |  | 
|---|
| [5896] | 35 | #include "core/BaseObject.h" | 
|---|
| [6417] | 36 | #include "network/synchronisable/Synchronisable.h" | 
|---|
 | 37 | #include "BaseSound.h" | 
|---|
 | 38 | #include "MoodManager.h" | 
|---|
| [5896] | 39 |  | 
|---|
| [3060] | 40 | namespace orxonox | 
|---|
 | 41 | { | 
|---|
 | 42 |     /** | 
|---|
| [5896] | 43 |      * The AmbientSound class is the base class for all sound file loader classes. | 
|---|
| [3060] | 44 |      * It server as main interface to the OpenAL library. | 
|---|
 | 45 |      * | 
|---|
 | 46 |      */ | 
|---|
| [6417] | 47 |     class _OrxonoxExport AmbientSound : public BaseSound, public BaseObject, public Synchronisable, public MoodListener | 
|---|
| [3060] | 48 |     { | 
|---|
| [6417] | 49 |         friend class SoundManager; | 
|---|
 | 50 |  | 
|---|
| [3060] | 51 |     public: | 
|---|
| [5896] | 52 |         AmbientSound(BaseObject* creator); | 
|---|
| [3060] | 53 |  | 
|---|
| [6417] | 54 |         void XMLPort(Element& xmlelement, XMLPort::Mode mode); | 
|---|
 | 55 |         void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); | 
|---|
 | 56 |         void changedActivity(); | 
|---|
| [3060] | 57 |  | 
|---|
| [6417] | 58 |         void play(); | 
|---|
 | 59 |         void stop(); | 
|---|
 | 60 |         void pause(); | 
|---|
 | 61 |  | 
|---|
 | 62 |         void setAmbientSource(const std::string& source); | 
|---|
 | 63 |         inline const std::string& getAmbientSource() const | 
|---|
 | 64 |             { return this->ambientSource_; } | 
|---|
 | 65 |  | 
|---|
 | 66 |         void setPlayOnLoad(bool val); | 
|---|
 | 67 |         bool getPlayOnLoad() const | 
|---|
 | 68 |             { return this->bPlayOnLoad_; } | 
|---|
 | 69 |  | 
|---|
 | 70 |     protected: | 
|---|
 | 71 |         ~AmbientSound() { } | 
|---|
 | 72 |  | 
|---|
| [3060] | 73 |     private: | 
|---|
| [6417] | 74 |         void preDestroy(); | 
|---|
 | 75 |         void registerVariables(); | 
|---|
 | 76 |         float getRealVolume(); | 
|---|
 | 77 |         void moodChanged(const std::string& mood); | 
|---|
 | 78 |         inline void ambientSourceChanged() | 
|---|
 | 79 |             { this->setAmbientSource(this->ambientSource_); } | 
|---|
 | 80 |         inline void playOnLoadChanged() | 
|---|
 | 81 |             { this->setPlayOnLoad(this->bPlayOnLoad_); } | 
|---|
 | 82 |  | 
|---|
 | 83 |         std::string ambientSource_; //!< Analogous to source_, but mood independent | 
|---|
 | 84 |         bool        bPlayOnLoad_;   //!< Play the sound immediately when loaded | 
|---|
| [5896] | 85 |     }; | 
|---|
 | 86 | } | 
|---|
| [3060] | 87 |  | 
|---|
| [5896] | 88 | #endif /* _AmbientSound_H__ */ | 
|---|