MCPcopy Create free account
hub / github.com/RobLoach/raylib-cpp / Sound

Class Sound

include/Sound.hpp:19–54  ·  view source on GitHub ↗

* Wave/Sound management functions. * * The sound will be unloaded on object destruction. Use raylib::SoundUnmanaged if you're looking to not unload. * * @code * raylib::Sound boom("boom.wav"); * boom.Play(); * @endcode * * @see raylib::SoundUnmanaged */

Source from the content-addressed store, hash-verified

17 * @see raylib::SoundUnmanaged
18 */
19class Sound : public SoundUnmanaged {
20public:
21 using SoundUnmanaged::SoundUnmanaged;
22
23 Sound(const Sound&) = delete;
24 Sound& operator=(const Sound&) = delete;
25
26 Sound(Sound&& other) noexcept {
27 set(other);
28 other.stream = {nullptr, nullptr, 0, 0, 0};
29 other.frameCount = 0;
30 }
31
32 Sound& operator=(Sound&& other) noexcept {
33 if (this == &other) {
34 return *this;
35 }
36 Unload();
37 set(other);
38 other.frameCount = 0;
39 other.stream = {nullptr, nullptr, 0, 0, 0};
40 return *this;
41 }
42
43 ~Sound() { Unload(); }
44
45 void Load(const std::string& fileName) {
46 Unload();
47 SoundUnmanaged::Load(fileName);
48 }
49
50 void Load(const ::Wave& wave) {
51 Unload();
52 SoundUnmanaged::Load(wave);
53 }
54};
55} // namespace raylib
56
57using RSound = raylib::Sound;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected