1 #ifndef RAYLIB_CPP_INCLUDE_WAVE_HPP_
2 #define RAYLIB_CPP_INCLUDE_WAVE_HPP_
6 #include "./raylib.hpp"
7 #include "./raylib-cpp-utils.hpp"
15 Wave(const ::Wave& wave) {
20 unsigned int frameCount = 0,
21 unsigned int sampleRate = 0,
22 unsigned int sampleSize = 0,
23 unsigned int channels = 0,
24 void *data =
nullptr) :
::Wave{frameCount, sampleRate, sampleSize, channels, data} { }
29 Wave(
const std::string& fileName) {
30 set(::LoadWave(fileName.c_str()));
36 Wave(
const std::string& fileType,
const unsigned char *fileData,
int dataSize) {
37 set(::LoadWaveFromMemory(fileType.c_str(), fileData, dataSize));
61 GETTERSETTER(
unsigned int, FrameCount, frameCount)
62 GETTERSETTER(
unsigned int, SampleRate, sampleRate)
63 GETTERSETTER(
unsigned int, SampleSize, sampleSize)
64 GETTERSETTER(
unsigned int, Channels, channels)
65 GETTERSETTER(
void *, Data, data)
67 Wave& operator=(const ::
Wave& wave) {
83 Wave& operator=(Wave&& other) {
103 inline Wave&
Format(
int SampleRate,
int SampleSize,
int Channels = 2) {
104 ::WaveFormat(
this, SampleRate, SampleSize, Channels);
112 return ::WaveCopy(*
this);
118 inline Wave&
Crop(
int initSample,
int finalSample) {
119 ::WaveCrop(
this, initSample, finalSample);
127 return ::LoadWaveSamples(*
this);
134 ::UnloadWaveSamples(samples);
140 inline bool Export(
const std::string& fileName) {
142 return ::ExportWave(*
this, fileName.c_str());
150 return ::ExportWaveAsCode(*
this, fileName.c_str());
157 if (data !=
nullptr) {
167 return ::LoadSoundFromWave(*
this);
173 inline operator ::Sound() {
183 return data !=
nullptr;
187 inline void set(const ::Wave& wave) {
188 frameCount = wave.frameCount;
189 sampleRate = wave.sampleRate;
190 sampleSize = wave.sampleSize;
191 channels = wave.channels;
197 #endif // RAYLIB_CPP_INCLUDE_WAVE_HPP_