raylib_impl 0.1.0
Vendor raylib 5.5 : IGraphic2Module / IGraphic3Module / IAudioModule
Loading...
Searching...
No Matches
RaySoundBuffer.hpp
Go to the documentation of this file.
1
11#ifndef RAYSOUNDBUFFER_HPP_
12#define RAYSOUNDBUFFER_HPP_
13
14//Raylib (without conflict)
15#include "RaylibAliases.hpp"
16
17//Interface
18#include "ISoundBuffer.hpp"
19
25class RaySoundBuffer : public audio::ISoundBuffer {
26
27 public:
28 RaySoundBuffer(std::string path) {
29 _sound = raylib::LoadSound(path.c_str());
30 }
31
33 raylib::UnloadSound(_sound);
34 }
35
36 bool isReady() const override {
37 return raylib::IsSoundValid(_sound);
38 }
39
40 float getLength() const override {
41 return _sound.frameCount / static_cast<float>(_sound.stream.sampleRate);
42 }
43
44 raylib::Sound handle() const {
45 return _sound;
46 }
47
48 private:
49 raylib::Sound _sound;
50};
51
54#endif /* !RAYSOUNDBUFFER_HPP_ */
Raylib SoundBuffer class - owns the loaded samples (raylib's own LoadSound() result)....
Definition RaySoundBuffer.hpp:25
RaySoundBuffer(std::string path)
Definition RaySoundBuffer.hpp:28
raylib::Sound handle() const
Definition RaySoundBuffer.hpp:44
bool isReady() const override
Definition RaySoundBuffer.hpp:36
~RaySoundBuffer()
Definition RaySoundBuffer.hpp:32
float getLength() const override
Definition RaySoundBuffer.hpp:40