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 SampleCount = 0,
21 unsigned int SampleRate = 0,
22 unsigned int SampleSize = 0,
23 unsigned int Channels = 0) {
24 sampleCount = SampleCount;
25 sampleRate = SampleRate;
26 sampleSize = SampleSize;
33 Wave(
const std::string& fileName) {
34 set(::LoadWave(fileName.c_str()));
40 Wave(
const std::string& fileType,
const unsigned char *fileData,
int dataSize) {
41 set(::LoadWaveFromMemory(fileType.c_str(), fileData, dataSize));
51 GETTERSETTER(
unsigned int, SampleCount, sampleCount)
52 GETTERSETTER(
unsigned int, SampleRate, sampleRate)
53 GETTERSETTER(
unsigned int, SampleSize, sampleSize)
54 GETTERSETTER(
unsigned int, Channels, channels)
55 GETTERSETTER(
void *, Data, data)
57 Wave& operator=(const ::
Wave& wave) {
65 inline Wave&
Format(
int SampleRate,
int SampleSize,
int Channels = 2) {
66 ::WaveFormat(
this, SampleRate, SampleSize, Channels);
74 return ::WaveCopy(*
this);
80 inline Wave&
Crop(
int initSample,
int finalSample) {
81 ::WaveCrop(
this, initSample, finalSample);
89 return ::LoadWaveSamples(*
this);
96 ::UnloadWaveSamples(samples);
102 inline bool Export(
const std::string& fileName) {
104 return ::ExportWave(*
this, fileName.c_str());
112 return ::ExportWaveAsCode(*
this, fileName.c_str());
129 return ::LoadSoundFromWave(*
this);
135 inline operator ::Sound() {
147 inline void set(const ::Wave& wave) {
148 sampleCount = wave.sampleCount;
149 sampleRate = wave.sampleRate;
150 sampleSize = wave.sampleSize;
151 channels = wave.channels;
157 #endif // RAYLIB_CPP_INCLUDE_WAVE_HPP_