Sound

class Sound

A sound object.

Public Functions

explicit Sound(const std::string &fileDir)

Create a sound.

Parameters:

fileDir – The directory of the sound file.

void play(int loops = 0, int playTime = -1, int fadeMs = 0)

Play the sound.

Parameters:
  • loops – The number of times to loop the sound.

  • playTime – The number of milliseconds to play the sound for.

  • fadeMs – The number of milliseconds to fade in.

void setVolume(float volume)

Set the volume of the sound.

Parameters:

volume – The volume to set.

float getVolume() const

Get the volume of the sound.

Returns:

The volume of the sound. Between 0.0f and 1.0f.

void unload()

Free the sound from memory.