Raylib C++  1.0.0
Encapsulates the raylib library
Public Member Functions | List of all members
raylib::audio::RlWave Class Reference

Encapsulation of the raylib Wave. More...

#include <RlWave.hpp>

Collaboration diagram for raylib::audio::RlWave:
Collaboration graph

Public Member Functions

 RlWave ()
 Default constructor. More...
 
 RlWave (const Wave &wave)
 Construct a new RlWave object from the raylib wave. More...
 
 RlWave (const std::string &path)
 Construct a new RlWave object. More...
 
 RlWave (const std::string &fileType, const unsigned char *fileData, int dataSize)
 Construct a new RlWave object. More...
 
 ~RlWave ()
 Destroy the RlWave object. More...
 
Wave & getWave ()
 Get the raylib wave. More...
 
const Wave & getWave () const
 Get the raylib wave. More...
 
bool exportWave (const std::string &fileName)
 Export wave data to file. More...
 
bool exportWaveAsCode (const std::string &fileName)
 Export wave sample data to code (.h) More...
 
raylib::audio::RlSound toSound () const
 Create a RlSound from the wave. More...
 
void format (const int &sampleRate, const int &sampleSize, const int &channels)
 Convert wave data to desired format. More...
 
RlWave copy ()
 Copy the RlWave. More...
 
void crop (const int &initSample, const int &finalSample)
 Crop a wave to defined samples range. More...
 
std::vector< float > getSamples ()
 Load samples data from wave as a floats array. More...
 

Detailed Description

Encapsulation of the raylib Wave.

Constructor & Destructor Documentation

◆ RlWave() [1/4]

raylib::audio::RlWave::RlWave ( )
inline

Default constructor.

◆ RlWave() [2/4]

raylib::audio::RlWave::RlWave ( const Wave &  wave)
explicit

Construct a new RlWave object from the raylib wave.

Parameters
wavethe raylib wave

◆ RlWave() [3/4]

raylib::audio::RlWave::RlWave ( const std::string &  path)
explicit

Construct a new RlWave object.

Parameters
paththe path of the wave (.wav)

◆ RlWave() [4/4]

raylib::audio::RlWave::RlWave ( const std::string &  fileType,
const unsigned char *  fileData,
int  dataSize 
)
explicit

Construct a new RlWave object.

Parameters
fileTypethe type of the wave
fileDatathe data of the wave
dataSizethe size of the data Please don't use this, I don't like raw pointer

◆ ~RlWave()

raylib::audio::RlWave::~RlWave ( )

Destroy the RlWave object.

Member Function Documentation

◆ copy()

raylib::audio::RlWave raylib::audio::RlWave::copy ( )

Copy the RlWave.

Returns
the RlWave

◆ crop()

void raylib::audio::RlWave::crop ( const int &  initSample,
const int &  finalSample 
)

Crop a wave to defined samples range.

Parameters
initSamplethe initial sample
finalSamplethe final sample

◆ exportWave()

bool raylib::audio::RlWave::exportWave ( const std::string &  fileName)

Export wave data to file.

Parameters
fileNamethe name of the file
Returns
true if the wave has been exported

◆ exportWaveAsCode()

bool raylib::audio::RlWave::exportWaveAsCode ( const std::string &  fileName)

Export wave sample data to code (.h)

Parameters
fileNamethe name of the file
Returns
true if the wave has been exported

◆ format()

void raylib::audio::RlWave::format ( const int &  sampleRate,
const int &  sampleSize,
const int &  channels 
)

Convert wave data to desired format.

Parameters
sampleRatethe sample rate
sampleSizethe sample size
channelsthe number of channels

◆ getSamples()

std::vector< float > raylib::audio::RlWave::getSamples ( )

Load samples data from wave as a floats array.

Returns
the samples data

◆ getWave() [1/2]

const Wave & raylib::audio::RlWave::getWave ( )

Get the raylib wave.

Returns
the raylib wave

◆ getWave() [2/2]

const Wave& raylib::audio::RlWave::getWave ( ) const

Get the raylib wave.

Returns
the raylib wave

◆ toSound()

raylib::audio::RlSound raylib::audio::RlWave::toSound ( ) const

Create a RlSound from the wave.

Returns
the RlSound

The documentation for this class was generated from the following files: