Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core5/src/orxonox/sound/BaseSound.h @ 5904

Last change on this file since 5904 was 5904, checked in by rgrieder, 15 years ago

Ogg file loading should work again now using the Ogre resource system.

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