P-E-R-R-Y
Utilitaires, contrats et vendors du moteur, en une seule doc
Loading...
Searching...
No Matches
RaySoundBuffer.hpp
Go to the documentation of this file.
1
10
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
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
53
54#endif /* !RAYSOUNDBUFFER_HPP_ */
RaySoundBuffer(std::string path)
Definition RaySoundBuffer.hpp:28
raylib::Sound handle() const
Definition RaySoundBuffer.hpp:44
bool isReady() const override
notice if the buffer is ready
Definition RaySoundBuffer.hpp:36
~RaySoundBuffer()
Definition RaySoundBuffer.hpp:32
float getLength() const override
Get the Length of the buffered sound, in seconds.
Definition RaySoundBuffer.hpp:40
Loaded audio samples, independent of any ISound that plays them - deleting every ISound built from a ...
Definition ISoundBuffer.hpp:24