* \brief Class to handle sounds / musics * The music can be either streamed from disk or read from ram */
| 26 | * The music can be either streamed from disk or read from ram |
| 27 | */ |
| 28 | class Sound |
| 29 | { |
| 30 | private: |
| 31 | SoLoud::Soloud& m_manager; |
| 32 | std::shared_ptr<SoLoud::AudioSource> m_source; |
| 33 | SoLoud::handle m_handle; |
| 34 | float m_baseSamplerate; |
| 35 | float m_pitch = 1.f; |
| 36 | bool m_looping = false; |
| 37 | float m_volume = 1.f; |
| 38 | void applyChanges(); |
| 39 | |
| 40 | public: |
| 41 | Sound(SoLoud::Soloud& manager, std::shared_ptr<SoLoud::AudioSource> source); |
| 42 | [[nodiscard]] double getDuration() const; |
| 43 | void play(); |
| 44 | void pause() const; |
| 45 | void stop() const; |
| 46 | |
| 47 | void setPitch(float pitch); |
| 48 | [[nodiscard]] float getPitch() const; |
| 49 | |
| 50 | [[nodiscard]] SoundStatus getStatus() const; |
| 51 | |
| 52 | [[nodiscard]] double getOffset() const; |
| 53 | void setOffset(double offset) const; |
| 54 | |
| 55 | [[nodiscard]] float getVolume() const; |
| 56 | void setVolume(float volume); |
| 57 | |
| 58 | void setLooping(bool looping); |
| 59 | [[nodiscard]] bool getLooping() const; |
| 60 | }; |
| 61 | } |