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

Music stream type (audio file streaming from memory) More...

Public Member Functions

 Music ()
 Default Music constructor to build an empty Music object.
 
 Music (const ::Music &music)
 
 Music (const Music &)=delete
 
 Music (const std::string &fileName)
 Load music stream from file. More...
 
 Music (const std::string &fileType, unsigned char *data, int dataSize)
 Load music stream from memory. More...
 
 Music (Music &&other)
 
 ~Music ()
 Unload music stream.
 
void * GetCtxData () const
 Retrieves the ctxData value for the object. More...
 
int GetCtxType () const
 Retrieves the ctxType value for the object. More...
 
unsigned int GetFrameCount () const
 Retrieves the frameCount value for the object. More...
 
bool GetLooping () const
 Retrieves the looping value for the object. More...
 
::AudioStream GetStream () const
 Retrieves the stream value for the object. More...
 
float GetTimeLength () const
 Get music time length (in seconds)
 
float GetTimePlayed () const
 Get current music time played (in seconds)
 
bool IsPlaying () const
 Check if music is playing.
 
bool IsReady () const
 Retrieve whether or not the Music has been loaded. More...
 
bool Load (const std::string &fileName)
 Load music stream from file.
 
bool Load (const std::string &fileType, unsigned char *data, int dataSize)
 Load music stream from memory.
 
Musicoperator= (const ::Music &music)
 
Musicoperator= (const Music &)=delete
 
Musicoperator= (Music &&other)
 
MusicPause ()
 Pause music playing.
 
MusicPlay ()
 Start music playing.
 
MusicResume ()
 Resume music playing.
 
MusicSeek (float position)
 Seek music to a position (in seconds)
 
void SetCtxData (void *value)
 Sets the ctxData value for the object. More...
 
void SetCtxType (int value)
 Sets the ctxType value for the object. More...
 
void SetFrameCount (unsigned int value)
 Sets the frameCount value for the object. More...
 
void SetLooping (bool value)
 Sets the looping value for the object. More...
 
MusicSetPitch (float pitch)
 Set pitch for music.
 
void SetStream (::AudioStream value)
 Sets the stream value for the object. More...
 
MusicSetVolume (float volume)
 Set volume for music.
 
MusicStop ()
 Stop music playing.
 
void Unload ()
 Unload music stream.
 
MusicUpdate ()
 Updates buffers for music streaming.
 

Detailed Description

Music stream type (audio file streaming from memory)

Definition at line 14 of file Music.hpp.

Constructor & Destructor Documentation

◆ Music() [1/2]

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

Load music stream from file.

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

Definition at line 36 of file Music.hpp.

References Load().

◆ Music() [2/2]

raylib::Music::Music ( const std::string &  fileType,
unsigned char *  data,
int  dataSize 
)
inline

Load music stream from memory.

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

Definition at line 47 of file Music.hpp.

References Load().

Member Function Documentation

◆ GetCtxData()

void* raylib::Music::GetCtxData ( ) const
inline

Retrieves the ctxData value for the object.

Returns
The ctxData value of the object.

Definition at line 76 of file Music.hpp.

◆ GetCtxType()

int raylib::Music::GetCtxType ( ) const
inline

Retrieves the ctxType value for the object.

Returns
The ctxType value of the object.

Definition at line 75 of file Music.hpp.

◆ GetFrameCount()

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

Retrieves the frameCount value for the object.

Returns
The frameCount value of the object.

Definition at line 73 of file Music.hpp.

◆ GetLooping()

bool raylib::Music::GetLooping ( ) const
inline

Retrieves the looping value for the object.

Returns
The looping value of the object.

Definition at line 74 of file Music.hpp.

◆ GetStream()

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

Retrieves the stream value for the object.

Returns
The stream value of the object.

Definition at line 72 of file Music.hpp.

◆ IsReady()

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

Retrieve whether or not the Music has been loaded.

Returns
True or false depending on whether the Music has been loaded.

Definition at line 215 of file Music.hpp.

Referenced by Load().

◆ SetCtxData()

void raylib::Music::SetCtxData ( void *  value)
inline

Sets the ctxData value for the object.

Parameters
valueThe value of which to set ctxData to.

Definition at line 76 of file Music.hpp.

◆ SetCtxType()

void raylib::Music::SetCtxType ( int  value)
inline

Sets the ctxType value for the object.

Parameters
valueThe value of which to set ctxType to.

Definition at line 75 of file Music.hpp.

◆ SetFrameCount()

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

Sets the frameCount value for the object.

Parameters
valueThe value of which to set frameCount to.

Definition at line 73 of file Music.hpp.

◆ SetLooping()

void raylib::Music::SetLooping ( bool  value)
inline

Sets the looping value for the object.

Parameters
valueThe value of which to set looping to.

Definition at line 74 of file Music.hpp.

◆ SetStream()

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

Sets the stream value for the object.

Parameters
valueThe value of which to set stream to.

Definition at line 72 of file Music.hpp.