Practical Tools for Simple Design
Loading...
Searching...
No Matches
SFX.hpp
1#ifndef UTIL_SFX_HPP
2#define UTIL_SFX_HPP
3
4#include "pch.hpp" // IWYU pragma: export
5
6#include "Util/AssetStore.hpp"
7
8namespace Util {
9
17class SFX {
18public:
19 SFX() = delete;
20
26 explicit SFX(const std::string &path);
27
31 SFX(const SFX &) = delete;
32
37 SFX &operator=(const SFX &) = delete;
38
43 int GetVolume() const;
44
52 void SetVolume(int volume);
53
58 void LoadMedia(const std::string &path);
59
64 void VolumeUp(int step = 1);
65
70 void VolumeDown(int step = 1);
71
80 void Play(int loop = 0, int duration = -1);
81
92 void FadeIn(unsigned int tick, int oop = -1, unsigned int duration = -1);
93
94private:
96
97private:
98 std::shared_ptr<Mix_Chunk> m_Chunk;
99};
100
101} // namespace Util
102#endif // UTIL_SFX_HPP
A class template for managing assets.
Definition: AssetStore.hpp:20
Class for handling sound effects.
Definition: SFX.hpp:17
void Play(int loop=0, int duration=-1)
Plays the sound effect.
SFX(const std::string &path)
Constructor that initializes the SFX object and loads the sound effect from the specified file path.
SFX(const SFX &)=delete
Deleted copy constructor to prevent copying of SFX objects.
int GetVolume() const
Retrieves the current volume of the sound effect.
SFX & operator=(const SFX &)=delete
Deleted copy assignment operator to prevent copying of SFX objects.
void FadeIn(unsigned int tick, int oop=-1, unsigned int duration=-1)
Fades in the sound effect gradually.
void LoadMedia(const std::string &path)
Loads the sound effect from the specified file path.
void VolumeUp(int step=1)
Increases the volume of the sound effect by one.
void VolumeDown(int step=1)
Decreases the volume of the sound effect by one.
void SetVolume(int volume)
Sets the volume of the background music.
Useful tools for development.
Definition: Animation.hpp:12