Documentation > Sounds > Sound
Version: 2.0.4
Constructor Sound(File, Type, NbLoop, Volume)
This fonction create a new Sound object.
File
Path of the sound file.
Type
Type of sound; could only be 'stream', 'static' or 'queue' (Löve2D requirements).
NbLoop
Number of time the sound could be played. -1 to indicate infinite.
Volume
Volume of the sound between 0 and 1. Normal sound is 1 (default).
Return
Returns an instance of Sound object
Sound:isPlaying()
This function returns true if the sound is playing; false otherwise.
Return
Returns true if the sound is playing; false otherwise.
Sound:isSameSound()
This function returns true if the sound is the same name and type as the given one; false otherwise.
Return
Returns true if the sound is the same name and type as the given one; false otherwise.
Sound:pause()
Pause the current sound or play it if paused.
Sound:play()
Play the current sound at its defined volume only if it is positive.
Sound:setLooping(NbLoop)
Define the number of times the sound can be played; none by default.
NbLoop
Number of time the sound can be played. -1 for infinite and 0 for none.
Sound:setNewSound(File)
This function sets a new sound. If the current sound is playing, stop it and then change the sound.
File
Path and name of the sound file
Type
Type of sound; could only be 'stream', 'static' or 'queue' (Löve2D requirements).
Sound:setVolume(Volume)
This function sets the sound volume. If negative or not defined, set it to 0.
Volume
Volume value.
Sound:stop()
This function stops the sound.
Sound:update(dt)
This function updates the number of loops already done. if nbloop < 0, the sound is always played.
dt
Delta time.
Me contacter