ChaiLove API  0.28.0
Public Member Functions
love::audio Class Reference

Provides an interface to output sound to the user's speakers. More...

Public Member Functions

bool play (SoundData *soundData)
 Plays the specified sound. More...
 
SoundDatanewSource (const std::string &filename, const std::string &type)
 Creates a new audio source from a file. More...
 
float getVolume ()
 Returns the master volume. More...
 
audiosetVolume (float volume)
 Set the master volume. More...
 

Detailed Description

Provides an interface to output sound to the user's speakers.

See also
love.sound

Member Function Documentation

◆ getVolume()

float love::audio::getVolume ( )

Returns the master volume.

Returns
The current master volume between 0.0f and 1.0f.
See also
setVolume

◆ newSource()

SoundData* love::audio::newSource ( const std::string &  filename,
const std::string &  type 
)

Creates a new audio source from a file.

Parameters
filenameThe .wav file to load.
type("static") The type of audio source to load ("static", "stream"). Optional.
Returns
The new SoundData if it loaded correctly, NULL otherwise.
See also
love.sound.newSoundData

◆ play()

bool love::audio::play ( SoundData soundData)

Plays the specified sound.

Parameters
soundDataThe sound to play.
Returns
True or false, depending on whether or not the sound data successfully played.

◆ setVolume()

audio& love::audio::setVolume ( float  volume)

Set the master volume.

Parameters
volume1.0f is max and 0.0f is off.
Returns
The audio module, to allow method chaining.
See also
getVolume