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