raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
raylib::Wave Class Reference

Wave type, defines audio wave data. More...

Public Member Functions

 Wave (const ::Wave &wave)
 
 Wave (const std::string &fileName)
 Load wave data from file. More...
 
 Wave (const std::string &fileType, const unsigned char *fileData, int dataSize)
 Load wave from memory buffer, fileType refers to extension: i.e. More...
 
 Wave (const Wave &other)
 
 Wave (unsigned int frameCount=0, unsigned int sampleRate=0, unsigned int sampleSize=0, unsigned int channels=0, void *data=nullptr)
 
 Wave (Wave &&other)
 
 ~Wave ()
 Unload wave data.
 
::Wave Copy () const
 Copy a wave to a new wave.
 
WaveCrop (int initSample, int finalSample)
 Crop a wave to defined samples range.
 
bool Export (const std::string &fileName)
 Export wave data to file, returns true on success.
 
bool ExportAsCode (const std::string &fileName)
 Export wave sample data to code (.h), returns true on success.
 
WaveFormat (int SampleRate, int SampleSize, int Channels=2)
 Convert wave data to desired format.
 
unsigned int GetChannels () const
 Retrieves the channels value for the object. More...
 
void * GetData () const
 Retrieves the data value for the object. More...
 
unsigned int GetFrameCount () const
 Retrieves the frameCount value for the object. More...
 
unsigned int GetSampleRate () const
 Retrieves the sampleRate value for the object. More...
 
unsigned int GetSampleSize () const
 Retrieves the sampleSize value for the object. More...
 
bool IsValid () const
 Retrieve whether or not the Wave data has been loaded. More...
 
void Load (const std::string &fileName)
 Load wave data from file. More...
 
void Load (const std::string &fileType, const unsigned char *fileData, int dataSize)
 Load wave from memory buffer, fileType refers to extension: i.e. More...
 
float * LoadSamples ()
 Load samples data from wave as a floats array.
 
::Sound LoadSound ()
 Load sound from wave data.
 
 operator::Sound ()
 Load sound from wave data.
 
Waveoperator= (const ::Wave &wave)
 
Waveoperator= (const Wave &other)
 
Waveoperator= (Wave &&other) noexcept
 
void Unload ()
 Unload wave data.
 

Static Public Member Functions

static void UnloadSamples (float *samples)
 Unload samples data loaded with LoadWaveSamples()
 

Protected Member Functions

void set (const ::Wave &wave)
 

Detailed Description

Wave type, defines audio wave data.

Definition at line 14 of file Wave.hpp.

Constructor & Destructor Documentation

◆ Wave() [1/2]

raylib::Wave::Wave ( const std::string &  fileName)
inline

Load wave data from file.

Exceptions
raylib::RaylibExceptionThrows if the Wave failed to load.

Definition at line 33 of file Wave.hpp.

References Load().

◆ Wave() [2/2]

raylib::Wave::Wave ( const std::string &  fileType,
const unsigned char *  fileData,
int  dataSize 
)
inline

Load wave from memory buffer, fileType refers to extension: i.e.

"wav"

Exceptions
raylib::RaylibExceptionThrows if the Wave failed to load.

Definition at line 40 of file Wave.hpp.

References Load().

Member Function Documentation

◆ GetChannels()

unsigned int raylib::Wave::GetChannels ( ) const
inline

Retrieves the channels value for the object.

Returns
The channels value of the object.

Definition at line 64 of file Wave.hpp.

◆ GetData()

void* raylib::Wave::GetData ( ) const
inline

Retrieves the data value for the object.

Returns
The data value of the object.

Definition at line 65 of file Wave.hpp.

◆ GetFrameCount()

unsigned int raylib::Wave::GetFrameCount ( ) const
inline

Retrieves the frameCount value for the object.

Returns
The frameCount value of the object.

Definition at line 61 of file Wave.hpp.

◆ GetSampleRate()

unsigned int raylib::Wave::GetSampleRate ( ) const
inline

Retrieves the sampleRate value for the object.

Returns
The sampleRate value of the object.

Definition at line 62 of file Wave.hpp.

◆ GetSampleSize()

unsigned int raylib::Wave::GetSampleSize ( ) const
inline

Retrieves the sampleSize value for the object.

Returns
The sampleSize value of the object.

Definition at line 63 of file Wave.hpp.

◆ IsValid()

bool raylib::Wave::IsValid ( ) const
inline

Retrieve whether or not the Wave data has been loaded.

Returns
True or false depending on whether the wave data has been loaded.

Definition at line 197 of file Wave.hpp.

Referenced by Load().

◆ Load() [1/2]

void raylib::Wave::Load ( const std::string &  fileName)
inline

Load wave data from file.

Exceptions
raylib::RaylibExceptionThrows if the Wave failed to load.

Definition at line 173 of file Wave.hpp.

References IsValid().

Referenced by Wave().

◆ Load() [2/2]

void raylib::Wave::Load ( const std::string &  fileType,
const unsigned char *  fileData,
int  dataSize 
)
inline

Load wave from memory buffer, fileType refers to extension: i.e.

"wav"

Exceptions
raylib::RaylibExceptionThrows if the Wave failed to load.

Definition at line 185 of file Wave.hpp.

References IsValid().