lovr.audio.newSource

Creates a new Source from an ogg, wav, or mp3 file.


source = lovr.audio.newSource(filename, options)

Arguments

NameTypeDefaultDescription
filenamestring The filename of the sound to load.
optionstable Optional options.
.decodebooleanfalse Whether to immediately decode compressed sounds.
.effectstabletrue A table of Effects to enable. Keys can be integers (list) or effect names (map), or a combination of both. The special value false can be used to completely disable effects, bypassing the spatializer entirely and throwing an error when trying to enable effects. true will enable all effects.

Returns

NameTypeDescription
sourceSource The new Source.

source = lovr.audio.newSource(blob, options)

Arguments

NameTypeDefaultDescription
blobBlob The Blob containing the Source data.
optionstable Optional options.
.decodebooleanfalse Whether to immediately decode compressed sounds.
.effectstabletrue A table of Effects to enable. Keys can be integers (list) or effect names (map), or a combination of both. The special value false can be used to completely disable effects, bypassing the spatializer entirely and throwing an error when trying to enable effects. true will enable all effects.

Returns

NameTypeDescription
sourceSource The new Source.

source = lovr.audio.newSource(sound, options)

Arguments

NameTypeDefaultDescription
soundSound The Sound containing raw audio samples to play.
optionstable Optional options.
.decodebooleanfalse Whether to immediately decode compressed sounds.
.effectstabletrue A table of Effects to enable. Keys can be integers (list) or effect names (map), or a combination of both. The special value false can be used to completely disable effects, bypassing the spatializer entirely and throwing an error when trying to enable effects. true will enable all effects.

Returns

NameTypeDescription
sourceSource The new Source.

Example

function lovr.load()
  sandstorm = lovr.audio.newSource('darude.ogg', {
    decode = false,
    effects = { 'spatialization', attenuation = false, reverb = true }
  })

  sandstorm:play()
end

See also