I have been going through my code, tidying it up and fixing memory leaks but I have something I can’t find an answer to.
I’m not doing anything fancy with my sounds, here’s how I use them.
local correctSoundFX = audio.loadSound( "sounds/success.ogg" ) local correctSound local Vol = 0.5 local someFunction = function() ... correctSound = audio.play( correctSoundFX ) audio.setVolume( Vol, { channel=correctSound }) ... end
Then on exitScene() I dispose of them
audio.stop() audio.dispose(correctSoundFX) correctSound = nil correctSoundFX = nil
What I don’t understand is what happens every time you call the function and the sound gets played, is there a new instance of the correctSound being created each time thus creating a memory leak or is it just played again? Can anyone tell me if there is anything wrong with what I’m doing here?
Many thanks in advance.