raylib-cpp
C++ object-oriented wrapper library for raylib.
Public 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.
 
 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.
 
inline ::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 IsReady () const
 Retrieve whether or not the Wave data has been loaded. More...
 
bool Load (const std::string &fileName)
 Load wave data from file. More...
 
bool 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.
 
inline ::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)
 
void SetChannels (unsigned int value)
 Sets the channels value for the object. More...
 
void SetData (void *value)
 Sets the data value for the object. More...
 
void SetFrameCount (unsigned int value)
 Sets the frameCount value for the object. More...
 
void SetSampleRate (unsigned int value)
 Sets the sampleRate value for the object. More...
 
void SetSampleSize (unsigned int value)
 Sets the sampleSize value for the object. More...
 
void Unload ()
 Unload wave data.
 
void UnloadSamples (float *samples)
 Unload samples data loaded with LoadWaveSamples()
 

Detailed Description

Wave type, defines audio wave data.

Definition at line 14 of file Wave.hpp.

Constructor & Destructor Documentation

◆ Wave()

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"

Definition at line 41 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 71 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 72 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 68 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 69 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 70 of file Wave.hpp.

◆ IsReady()

bool raylib::Wave::IsReady ( ) 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 209 of file Wave.hpp.

Referenced by Load().

◆ Load() [1/2]

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

Load wave data from file.

Returns
True or false depending on if the Wave data was loaded properly.

Definition at line 189 of file Wave.hpp.

References IsReady().

Referenced by Wave().

◆ Load() [2/2]

bool 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"

Returns
True or false depending on if the Wave data was loaded properly.

Definition at line 199 of file Wave.hpp.

References IsReady().

◆ SetChannels()

void raylib::Wave::SetChannels ( unsigned int  value)
inline

Sets the channels value for the object.

Parameters
valueThe value of which to set channels to.

Definition at line 71 of file Wave.hpp.

◆ SetData()

void raylib::Wave::SetData ( void *  value)
inline

Sets the data value for the object.

Parameters
valueThe value of which to set data to.

Definition at line 72 of file Wave.hpp.

◆ SetFrameCount()

void raylib::Wave::SetFrameCount ( unsigned int  value)
inline

Sets the frameCount value for the object.

Parameters
valueThe value of which to set frameCount to.

Definition at line 68 of file Wave.hpp.

◆ SetSampleRate()

void raylib::Wave::SetSampleRate ( unsigned int  value)
inline

Sets the sampleRate value for the object.

Parameters
valueThe value of which to set sampleRate to.

Definition at line 69 of file Wave.hpp.

◆ SetSampleSize()

void raylib::Wave::SetSampleSize ( unsigned int  value)
inline

Sets the sampleSize value for the object.

Parameters
valueThe value of which to set sampleSize to.

Definition at line 70 of file Wave.hpp.