if you dispose a handler, every further call to that handler will fail. also you can’t dispose a sound that is playing or paused.
I never use audio.dispose(), btw.
I prefetch all sounds inside a table and call the identifier inside that table to play a sound.
Here, I took this snippet from somewhere on this site:
GameSounds= {
["laserSound"] = audio.loadSound( "laser1.wav" ),
["secLaserSound"] = audio.loadSound( "laser2.wav" )
}
function playSnd(sndKey)
local sndChanFree = audio.findFreeChannel()
audio.play( GameSounds[sndKey], { channel = sndChanFree } )
return;
end
-- usage:
playSnd("laserSound") -- plays laser1.wav
As long as you don’t use tons of megabytes of sounds, this should work without any crashes…
-finefin [import]uid: 70635 topic_id: 14695 reply_id: 54385[/import]