natiny.clip.load

Lua
natiny.clip.load(ogg) -> clip

Decodes an Ogg Vorbis resource into a clip.

Parameters

Name Type Description
ogg number Resource handle containing Ogg Vorbis data

Returns

Type Description
number Clip handle

Example

Lua
local clip = natiny.clip.load(ogg)

Notes

  • Ogg Vorbis is the only supported format. The complete file is decoded when this function returns; the resource may then be destroyed.
  • A clip is not an entity. Multiple audio sources can share its decoded samples.
  • Decoding costs memory: 16 bits per sample per channel at the file's own rate, held until the clip is destroyed.
  • Audio output need not be available; a clip loads on a machine with no sound card and stays silent.
  • Lua raises an error for an invalid resource, invalid Ogg data or allocation failure.