| [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 |  *      Erwin 'vaiursch' Herrsche | 
|---|
| [3060] | 24 |  *   Co-authors: | 
|---|
| [5896] | 25 |  *      Reto Grieder | 
|---|
| [3060] | 26 |  * | 
|---|
 | 27 |  */ | 
|---|
| [5896] | 28 | #ifndef _BaseSound_H__ | 
|---|
 | 29 | #define _BaseSound_H__ | 
|---|
| [3060] | 30 |  | 
|---|
 | 31 | #include "OrxonoxPrereqs.h" | 
|---|
 | 32 |  | 
|---|
| [5896] | 33 | #include <string> | 
|---|
| [5904] | 34 | #include <OgreSharedPtr.h> | 
|---|
 | 35 | #include <OgreDataStream.h> | 
|---|
| [5896] | 36 | #include "core/OrxonoxClass.h" | 
|---|
 | 37 |  | 
|---|
| [3060] | 38 | namespace orxonox | 
|---|
 | 39 | { | 
|---|
 | 40 |     /** | 
|---|
| [5896] | 41 |      * The BaseSound class is the base class for all sound file loader classes. | 
|---|
| [3060] | 42 |      * It server as main interface to the OpenAL library. | 
|---|
 | 43 |      * | 
|---|
 | 44 |      */ | 
|---|
| [5896] | 45 |     class _OrxonoxExport BaseSound : virtual public OrxonoxClass | 
|---|
| [3060] | 46 |     { | 
|---|
 | 47 |     public: | 
|---|
| [5896] | 48 |         BaseSound(); | 
|---|
 | 49 |         virtual ~BaseSound(); | 
|---|
| [3060] | 50 |  | 
|---|
| [5982] | 51 |         virtual void play(); | 
|---|
 | 52 |         virtual void replay();      // is only needed for the AmbientSound list in SoundManager | 
|---|
 | 53 |         virtual void stop(); | 
|---|
 | 54 |         virtual void pause(); | 
|---|
| [3060] | 55 |  | 
|---|
 | 56 |         bool isPlaying(); | 
|---|
 | 57 |         bool isPaused(); | 
|---|
 | 58 |         bool isStopped(); | 
|---|
 | 59 |  | 
|---|
| [6031] | 60 |         virtual void setSource(const std::string& source); | 
|---|
| [5899] | 61 |         const std::string& getSource() { return this->source_; } | 
|---|
| [3060] | 62 |  | 
|---|
| [5896] | 63 |         bool getPlayOnLoad() { return this->bPlayOnLoad_; } | 
|---|
 | 64 |         void setPlayOnLoad(bool val); | 
|---|
 | 65 |  | 
|---|
 | 66 |         bool getLoop() { return this->bLoop_; } | 
|---|
 | 67 |         void setLoop(bool val) { this->bLoop_ = val; } | 
|---|
 | 68 |  | 
|---|
 | 69 |     protected: | 
|---|
| [5904] | 70 |         ALuint loadOggFile(); | 
|---|
| [5896] | 71 |         ALint getSourceState(); | 
|---|
 | 72 |  | 
|---|
| [5899] | 73 |         ALuint audioSource_; | 
|---|
 | 74 |         ALuint audioBuffer_; | 
|---|
| [3060] | 75 |  | 
|---|
| [5896] | 76 |     private: | 
|---|
| [5899] | 77 |         std::string source_; | 
|---|
| [5896] | 78 |         bool bPlayOnLoad_; | 
|---|
 | 79 |         bool bLoop_; | 
|---|
| [5904] | 80 |         DataStreamPtr dataStream_; | 
|---|
| [5896] | 81 |     }; | 
|---|
 | 82 | } | 
|---|
| [3060] | 83 |  | 
|---|
| [5896] | 84 | #endif /* _BaseSound_H__ */ | 
|---|