[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 | |
---|
[6417] | 35 | #include "BaseSound.h" |
---|
| 36 | #include "MoodManager.h" |
---|
[5896] | 37 | |
---|
[3060] | 38 | namespace orxonox |
---|
| 39 | { |
---|
| 40 | /** |
---|
[7854] | 41 | * The AmbientSound class is used to play background music. It can not be placed |
---|
| 42 | * directly in a level file, use WorldAmbientSound instead. |
---|
[3060] | 43 | */ |
---|
[7854] | 44 | class _OrxonoxExport AmbientSound : public BaseSound, public MoodListener |
---|
[3060] | 45 | { |
---|
[6417] | 46 | friend class SoundManager; |
---|
[7854] | 47 | friend class WorldAmbientSound; |
---|
[6417] | 48 | |
---|
[3060] | 49 | public: |
---|
[7854] | 50 | AmbientSound(); |
---|
[3060] | 51 | |
---|
[6417] | 52 | void play(); |
---|
[7856] | 53 | bool stop(); |
---|
[6417] | 54 | void pause(); |
---|
| 55 | |
---|
[9889] | 56 | bool setAmbientSource(const std::string& source); |
---|
[6417] | 57 | inline const std::string& getAmbientSource() const |
---|
| 58 | { return this->ambientSource_; } |
---|
| 59 | |
---|
| 60 | void setPlayOnLoad(bool val); |
---|
| 61 | bool getPlayOnLoad() const |
---|
| 62 | { return this->bPlayOnLoad_; } |
---|
| 63 | |
---|
| 64 | protected: |
---|
| 65 | ~AmbientSound() { } |
---|
| 66 | |
---|
[3060] | 67 | private: |
---|
[6417] | 68 | void preDestroy(); |
---|
| 69 | float getRealVolume(); |
---|
[9889] | 70 | bool moodChanged(const std::string& mood); |
---|
[6417] | 71 | inline void ambientSourceChanged() |
---|
| 72 | { this->setAmbientSource(this->ambientSource_); } |
---|
| 73 | inline void playOnLoadChanged() |
---|
| 74 | { this->setPlayOnLoad(this->bPlayOnLoad_); } |
---|
| 75 | |
---|
| 76 | std::string ambientSource_; //!< Analogous to source_, but mood independent |
---|
| 77 | bool bPlayOnLoad_; //!< Play the sound immediately when loaded |
---|
[5896] | 78 | }; |
---|
| 79 | } |
---|
[3060] | 80 | |
---|
[5896] | 81 | #endif /* _AmbientSound_H__ */ |
---|