lovr.audio.newSource

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

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

Arguments

NameTypeDefaultDescription
filenamestringThe filename of the sound to load.
optionstableOptional options.
.decodebooleanfalseWhether to immediately decode compressed sounds.
.effectstabletrueA 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. true will enable all effects.

Returns

NameTypeDescription
sourceSourceThe new Source.

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

Arguments

NameTypeDefaultDescription
blobBlobThe Blob containing the Source data.
optionstableOptional options.
.decodebooleanfalseWhether to immediately decode compressed sounds.
.effectstabletrueA 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. true will enable all effects.

Returns

NameTypeDescription
sourceSourceThe new Source.

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

Arguments

NameTypeDefaultDescription
soundSoundThe Sound containing raw audio samples to play.
optionstableOptional options.
.decodebooleanfalseWhether to immediately decode compressed sounds.
.effectstabletrueA 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. true will enable all effects.

Returns

NameTypeDescription
sourceSourceThe 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