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_view fileName)
 Load wave data from file. More...
 
 Wave (const std::string_view fileType, const unsigned char *fileData, int dataSize)
 Load wave from memory buffer, fileType refers to extension: i.e. More...
 
 Wave (const std::string_view fileType, std::span< const unsigned char > fileData)
 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. More...
 
::Wave Copy () const
 Copy a wave to a new wave. More...
 
WaveCrop (int initSample, int finalSample)
 Crop a wave to defined samples range. More...
 
bool Export (const std::string_view fileName)
 Export wave data to file, returns true on success. More...
 
bool ExportAsCode (const std::string_view fileName)
 Export wave sample data to code (.h), returns true on success. More...
 
WaveFormat (int SampleRate, int SampleSize, int Channels=2)
 Convert wave data to desired format. More...
 
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...
 
void Load (const std::string_view fileName)
 Load wave data from file. More...
 
void Load (const std::string_view fileType, const unsigned char *fileData, int dataSize)
 Load wave from memory buffer, fileType refers to extension: i.e. More...
 
void Load (const std::string_view fileType, std::span< const unsigned char > fileData)
 Load wave from memory buffer, fileType refers to extension: i.e. More...
 
float * LoadSamples ()
 Load samples data from wave as a floats array. More...
 
::Sound LoadSound ()
 Load sound from wave data. More...
 
 operator::Sound ()
 Load sound from wave data. More...
 
Waveoperator= (const ::Wave &wave)
 
Waveoperator= (const Wave &other)
 
Waveoperator= (Wave &&other) noexcept
 
void Unload ()
 Unload wave data. More...
 

Static Public Member Functions

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

Protected Member Functions

void set (const ::Wave &wave)
 

Detailed Description

Wave type, defines audio wave data.

Definition at line 16 of file Wave.hpp.

Constructor & Destructor Documentation

◆ Wave() [1/7]

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

Definition at line 18 of file Wave.hpp.

◆ Wave() [2/7]

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 22 of file Wave.hpp.

◆ Wave() [3/7]

raylib::Wave::Wave ( const std::string_view  fileName)
inline

Load wave data from file.

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

Definition at line 36 of file Wave.hpp.

References Load().

◆ Wave() [4/7]

raylib::Wave::Wave ( const std::string_view  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 45 of file Wave.hpp.

References Load().

◆ Wave() [5/7]

raylib::Wave::Wave ( const std::string_view  fileType,
std::span< const unsigned char >  fileData 
)
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 54 of file Wave.hpp.

References Load().

◆ Wave() [6/7]

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

Definition at line 58 of file Wave.hpp.

◆ Wave() [7/7]

raylib::Wave::Wave ( Wave &&  other)
inline

Definition at line 62 of file Wave.hpp.

◆ ~Wave()

raylib::Wave::~Wave ( )
inline

Unload wave data.

Definition at line 75 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 121 of file Wave.hpp.

◆ Crop()

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

Crop a wave to defined samples range.

Definition at line 128 of file Wave.hpp.

◆ Export()

bool raylib::Wave::Export ( const std::string_view  fileName)
inline

Export wave data to file, returns true on success.

Definition at line 158 of file Wave.hpp.

◆ ExportAsCode()

bool raylib::Wave::ExportAsCode ( const std::string_view  fileName)
inline

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

Definition at line 166 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 136 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 82 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 83 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 79 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 80 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 81 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 237 of file Wave.hpp.

Referenced by Load().

◆ Load() [1/3]

void raylib::Wave::Load ( const std::string_view  fileName)
inline

Load wave data from file.

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

Definition at line 201 of file Wave.hpp.

References IsReady().

Referenced by Wave().

◆ Load() [2/3]

void raylib::Wave::Load ( const std::string_view  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 213 of file Wave.hpp.

References IsReady().

◆ Load() [3/3]

void raylib::Wave::Load ( const std::string_view  fileType,
std::span< const unsigned char >  fileData 
)
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 225 of file Wave.hpp.

References IsReady().

◆ LoadSamples()

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

Load samples data from wave as a floats array.

Definition at line 144 of file Wave.hpp.

◆ LoadSound()

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

Load sound from wave data.

Definition at line 185 of file Wave.hpp.

Referenced by operator::Sound().

◆ operator::Sound()

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

Load sound from wave data.

Definition at line 192 of file Wave.hpp.

References LoadSound().

◆ operator=() [1/3]

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

Definition at line 85 of file Wave.hpp.

◆ operator=() [2/3]

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

Definition at line 90 of file Wave.hpp.

◆ operator=() [3/3]

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

Definition at line 101 of file Wave.hpp.

◆ set()

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

Definition at line 242 of file Wave.hpp.

◆ Unload()

void raylib::Wave::Unload ( )
inline

Unload wave data.

Definition at line 174 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 151 of file Wave.hpp.