Debian Codegraph @

src/game/STFH/source.hpp

raw symbols SCIP
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 #include <memory>
17
18 #include "data.hpp"
19 #include "location.hpp"
20
21 namespace STFH {
22
23 class Source
24 {
25 public:
26 //! Constructor.
27 Source();
28
29 //! Destructor.
30 virtual ~Source();
31
32 //! Set the sound data. Throw on failure.
33 virtual void setData(DataPtr data);
34
35 //! Play the sound.
36 virtual void play(bool loop = false) = 0;
37
38 //! Stop the sound.
39 virtual void stop() = 0;
40
41 /*! Set volume.
42 * \param volume 0.0..1.0 */
43 virtual void setVolume(float volume);
44
45 //! \return volume.
46 virtual float volume() const;
47
48 /*! Set pitch.
49 * \param pitch 0.0..1.0 */
50 virtual void setPitch(float pitch);
51
52 //! \return pitch.
53 virtual float pitch() const;
54
55 //! Set location.
56 virtual void setLocation(const Location & location);
57
58 //! \return location.
59 virtual const Location & location() const;
60
61 //! Set maximum distance.
62 virtual void setMaxDist(float maxDist);
63
64 //! Set reference distance.
65 virtual void setReferenceDist(float refDist);
66
67 private:
68 Location m_location;
69 float m_pitch;
70 float m_volume;
71 float m_maxDist;
72 float m_refDist;
73 DataPtr m_data;
74 };
75
76 typedef std::shared_ptr<Source> SourcePtr;
77
78 } // namespace STFH