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!
Available since LÖVE 11.0
This variant is not supported in earlier versions.
source = love.audio.newSource( filename, type )
string filenameSourceType typeSource source Available since LÖVE 11.0
This variant is not supported in earlier versions.
source = love.audio.newSource( file, type )
File fileSourceType typeSource source Available since LÖVE 11.0
This variant is not supported in earlier versions.
source = love.audio.newSource( decoder, type )
Decoder decoderSourceType typeSource source Available since LÖVE 11.0
This variant is not supported in earlier versions.
source = love.audio.newSource( data, type )
FileData dataSourceType typeSource sourcesource = love.audio.newSource( data )
SoundData dataSource source Removed in LÖVE 11.0
This variant is not supported in that and later versions.
source = love.audio.newSource( filename, type )
string filenameSourceType type ("stream")Source source Removed in LÖVE 11.0
This variant is not supported in that and later versions.
source = love.audio.newSource( file, type )
File fileSourceType type ("stream")Source source Removed in LÖVE 11.0
This variant is not supported in that and later versions.
source = love.audio.newSource( decoder, type )
Decoder decoderSourceType type ("stream")Source source Removed in LÖVE 11.0
This variant is not supported in that and later versions.
source = love.audio.newSource( data, type )
FileData dataSourceType type ("stream")Source sourceFrom 11.0 onwards, if queue is specified as SourceType for this specific constructor, it won't error, and getType will return stream; this is a bug. One should use love.audio.newQueueableSource for that specific source type instead.
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, "stream")
© 2006–2020 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.audio.newSource