raylib-cpp
C++ object-oriented wrapper library for raylib.
Loading...
Searching...
No Matches
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...

#include <Wave.hpp>

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.
 
 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) noexcept
 
 ~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.
 
void * GetData () const
 Retrieves the data value for the object.
 
unsigned int GetFrameCount () const
 Retrieves the frameCount value for the object.
 
unsigned int GetSampleRate () const
 Retrieves the sampleRate value for the object.
 
unsigned int GetSampleSize () const
 Retrieves the sampleSize value for the object.
 
bool IsValid () const
 Retrieve whether or not the Wave data has been loaded.
 
void Load (const std::string &fileName)
 Load wave data from file.
 
void Load (const std::string &fileType, const unsigned char *fileData, int dataSize)
 Load wave from memory buffer, fileType refers to extension: i.e.
 
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/6]

raylib::Wave::Wave ( const ::Wave &  wave)
inline

Definition at line 16 of file Wave.hpp.

◆ Wave() [2/6]

raylib::Wave::Wave ( unsigned int  frameCount = 0,
unsigned int  sampleRate = 0,
unsigned int  sampleSize = 0,
unsigned int  channels = 0,
void *  data = nullptr 
)
inline

Definition at line 18 of file Wave.hpp.

◆ Wave() [3/6]

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() [4/6]

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().

◆ Wave() [5/6]

raylib::Wave::Wave ( const Wave other)
inline

Definition at line 44 of file Wave.hpp.

◆ Wave() [6/6]

raylib::Wave::Wave ( Wave &&  other)
inlinenoexcept

Definition at line 46 of file Wave.hpp.

◆ ~Wave()

raylib::Wave::~Wave ( )
inline

Unload wave data.

Definition at line 59 of file Wave.hpp.

References Unload().

Member Function Documentation

◆ Copy()

::Wave raylib::Wave::Copy ( ) const
inline

Copy a wave to a new wave.

Definition at line 103 of file Wave.hpp.

◆ Crop()

Wave & raylib::Wave::Crop ( int  initSample,
int  finalSample 
)
inline

Crop a wave to defined samples range.

Definition at line 108 of file Wave.hpp.

◆ Export()

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

Export wave data to file, returns true on success.

Definition at line 134 of file Wave.hpp.

◆ ExportAsCode()

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

Export wave sample data to code (.h), returns true on success.

Definition at line 142 of file Wave.hpp.

◆ Format()

Wave & raylib::Wave::Format ( int  SampleRate,
int  SampleSize,
int  Channels = 2 
)
inline

Convert wave data to desired format.

Definition at line 116 of file Wave.hpp.

◆ 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(), and 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(), and 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().

◆ LoadSamples()

float * raylib::Wave::LoadSamples ( )
inline

Load samples data from wave as a floats array.

Definition at line 124 of file Wave.hpp.

◆ LoadSound()

::Sound raylib::Wave::LoadSound ( )
inline

Load sound from wave data.

Definition at line 161 of file Wave.hpp.

Referenced by operator::Sound().

◆ operator::Sound()

raylib::Wave::operator::Sound ( )
inline

Load sound from wave data.

Definition at line 166 of file Wave.hpp.

References LoadSound().

◆ operator=() [1/3]

Wave & raylib::Wave::operator= ( const ::Wave &  wave)
inline

Definition at line 67 of file Wave.hpp.

◆ operator=() [2/3]

Wave & raylib::Wave::operator= ( const Wave other)
inline

Definition at line 72 of file Wave.hpp.

◆ operator=() [3/3]

Wave & raylib::Wave::operator= ( Wave &&  other)
inlinenoexcept

Definition at line 83 of file Wave.hpp.

◆ set()

void raylib::Wave::set ( const ::Wave &  wave)
inlineprotected

Definition at line 199 of file Wave.hpp.

◆ Unload()

void raylib::Wave::Unload ( )
inline

Unload wave data.

Definition at line 150 of file Wave.hpp.

Referenced by ~Wave().

◆ UnloadSamples()

static void raylib::Wave::UnloadSamples ( float *  samples)
inlinestatic

Unload samples data loaded with LoadWaveSamples()

Definition at line 129 of file Wave.hpp.