Creates a new Source from a filepath, File, Decoder or SoundData. Sources created from SoundData are always static.
This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!
source = love.audio.newSource( filename, type )
string filename
SourceType type ("stream")
Source source
source = love.audio.newSource( file, type )
File file
SourceType type ("stream")
Source source
source = love.audio.newSource( decoder, type )
Decoder decoder
SourceType type ("stream")
Source source
source = love.audio.newSource( data )
SoundData data
Source source
source = love.audio.newSource( data )
FileData data
Source source
bgm = love.audio.newSource("bgm.ogg", "stream") love.audio.play(bgm)
sfx = love.audio.newSource("sfx.wav", "static") love.audio.play(sfx)
data = love.sound.newSoundData("sfx.wav") sfx = love.audio.newSource(data)
decoder = love.sound.newDecoder("bgm.ogg") bgm = love.audio.newSource(decoder)
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.audio.newSource