natiny.audio.source_destroy

Lua
natiny.audio.source_destroy(source)

Destroys a source and invalidates its entity handle.

Parameters

Name Type Description
source number Source handle

Example

Lua
natiny.audio.source_destroy(source)

Notes

  • Playback stops and the voice is released for the next source to take.
  • The clip is not touched: it belongs to whoever loaded it, and other sources may still be playing it. Free it with natiny.clip.destroy.
  • Listener handles are not accepted here; use natiny.audio.listener_destroy.
  • Everything parented to the source is destroyed with it, and so is everything parented to those, all the way down. Each one goes through the destroy its own kind has, so a child model gives back its parts, a child body leaves the physics world and a child source releases its voice - a subtree is freed as completely as its nodes would be one at a time.
  • Detach a child to keep it: natiny.entity.set_parent(child, 0) leaves its local transform as its world transform, and the destroy passes it by.
  • Invalid and already destroyed handles are ignored.