| 1 | // This file is part of Dust Racing 2D. |
| 2 | // Copyright (C) 2013 Jussi Lind <[email protected]> |
| 3 | // |
| 4 | // Dust Racing 2D is free software: you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation, either version 3 of the License, or |
| 7 | // (at your option) any later version. |
| 8 | // Dust Racing 2D is distributed in the hope that it will be useful, |
| 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | // GNU General Public License for more details. |
| 12 | // |
| 13 | // You should have received a copy of the GNU General Public License |
| 14 | // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>. |
| 15 | |
| 16 | #ifndef OPENALSOURCE_HPP |
| 17 | #define OPENALSOURCE_HPP |
| 18 | |
| 19 | #include <Data> |
| 20 | #include <Source> |
| 21 | |
| 22 | #include <AL/al.h> |
| 23 | #include <AL/alc.h> |
| 24 | |
| 25 | #include <string> |
| 26 | |
| 27 | class OpenALSource : public STFH::Source |
| 28 | { |
| 29 | public: |
| 30 | //! Constructor. |
| 31 | OpenALSource(STFH::DataPtr data); |
| 32 | |
| 33 | //! Destructor. |
| 34 | virtual ~OpenALSource(); |
| 35 | |
| 36 | //! \reimp |
| 37 | virtual void setData(STFH::DataPtr data) override; |
| 38 | |
| 39 | //! \reimp |
| 40 | virtual void play(bool loop = false) override; |
| 41 | |
| 42 | //! \reimp |
| 43 | virtual void stop() override; |
| 44 | |
| 45 | //! \reimp |
| 46 | virtual void setVolume(float volume) override; |
| 47 | |
| 48 | //! \reimp |
| 49 | virtual void setPitch(float pitch) override; |
| 50 | |
| 51 | //! \reimp |
| 52 | virtual void setLocation(const STFH::Location & location) override; |
| 53 | |
| 54 | //! \reimp |
| 55 | virtual void setMaxDist(float maxDist) override; |
| 56 | |
| 57 | //! \reimp |
| 58 | virtual void setReferenceDist(float refDist) override; |
| 59 | |
| 60 | private: |
| 61 | ALuint m_handle; |
| 62 | }; |
| 63 | |
| 64 | #endif // OPENALSOURCE_HPP |