Type Function Library audio.* Return value none Revision Current Public Release (2014.2381) Keywords audio, dispose See also audio.loadSound() audio.loadStream()
Releases audio memory associated with the handle.
You must not use the handle once the memory is freed. The audio should not be active (playing or paused) on any channel when you try to free it.
audio.dispose( audioHandle )
-- Load a laser sound and a background music stream into memory local laserSound = audio.loadSound( "laserSound.wav" ) local backgroundMusic = audio.loadStream( "backgroundMusic.m4a" ) -- Play both the sound and the stream local playLaserSound = audio.play( laserSound ) local playBackgroundMusic = audio.play( backgroundMusic ) -- Stop both the sound and the stream and 'nil' out each reference audio.stop( playLaserSound ) playLaserSound = nil audio.stop( playBackgroundMusic ) playBackgroundMusic = nil -- Dispose the handles from memory and 'nil' out each reference audio.dispose( laserSound ) audio.dispose( backgroundMusic ) laserSound = nil --prevents the handle from being used again backgroundMusic = nil --prevents the handle from being used again