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

Wave/Sound management functions. More...

Public Member Functions

 Sound (::AudioStream stream, unsigned int frameCount)
 
 Sound (const ::Wave &wave)
 Loads a sound from the given Wave. More...
 
 Sound (const Sound &)=delete
 
 Sound (const std::string &fileName)
 Loads a sound from the given file. More...
 
 Sound (Sound &&other)
 
unsigned int GetFrameCount () const
 Retrieves the frameCount value for the object. More...
 
::AudioStream GetStream () const
 Retrieves the stream value for the object. More...
 
bool IsPlaying () const
 Check if a sound is currently playing.
 
bool IsReady () const
 Retrieve whether or not the Sound buffer is loaded. More...
 
bool Load (const ::Wave &wave)
 Loads the given Wave object into the Sound.
 
bool Load (const std::string &fileName)
 Load a sound from the given file. More...
 
Soundoperator= (const Sound &)=delete
 
Soundoperator= (Sound &&other)
 
SoundPause ()
 Pause a sound.
 
SoundPlay ()
 Play a sound.
 
SoundPlayMulti ()
 Play a sound (using multichannel buffer pool)
 
SoundResume ()
 Resume a paused sound.
 
void SetFrameCount (unsigned int value)
 Sets the frameCount value for the object. More...
 
SoundSetPitch (float pitch)
 Set pitch for a sound (1.0 is base level)
 
void SetStream (::AudioStream value)
 Sets the stream value for the object. More...
 
SoundSetVolume (float volume)
 Set volume for a sound (1.0 is max level)
 
SoundStop ()
 Stop playing a sound.
 
SoundStopMulti ()
 Stop any sound playing (using multichannel buffer pool)
 
void Unload ()
 Unload sound.
 
SoundUpdate (const void *data)
 Update sound buffer with new data, assuming it's the same sample count.
 
SoundUpdate (const void *data, int samplesCount)
 Update sound buffer with new data.
 

Detailed Description

Wave/Sound management functions.

raylib::Sound boom("boom.wav");
boom.Play();

Definition at line 19 of file Sound.hpp.

Constructor & Destructor Documentation

◆ Sound() [1/2]

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

Loads a sound from the given file.

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

Definition at line 45 of file Sound.hpp.

References Load().

◆ Sound() [2/2]

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

Loads a sound from the given Wave.

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

Definition at line 56 of file Sound.hpp.

References Load().

Member Function Documentation

◆ GetFrameCount()

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

Retrieves the frameCount value for the object.

Returns
The frameCount value of the object.

Definition at line 66 of file Sound.hpp.

◆ GetStream()

::AudioStream raylib::Sound::GetStream ( ) const
inline

Retrieves the stream value for the object.

Returns
The stream value of the object.

Definition at line 67 of file Sound.hpp.

◆ IsReady()

bool raylib::Sound::IsReady ( ) const
inline

Retrieve whether or not the Sound buffer is loaded.

Returns
True or false depending on whether the Sound buffer is loaded.

Definition at line 200 of file Sound.hpp.

Referenced by Load().

◆ Load()

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

Load a sound from the given file.

Returns
True or false depending on loading worked.

Definition at line 181 of file Sound.hpp.

References IsReady().

Referenced by Sound().

◆ SetFrameCount()

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

Sets the frameCount value for the object.

Parameters
valueThe value of which to set frameCount to.

Definition at line 66 of file Sound.hpp.

◆ SetStream()

void raylib::Sound::SetStream ( ::AudioStream  value)
inline

Sets the stream value for the object.

Parameters
valueThe value of which to set stream to.

Definition at line 67 of file Sound.hpp.

References Unload().

raylib::Sound
Wave/Sound management functions.
Definition: Sound.hpp:19