Hi,
I am developing a game with 10 levels.There are several sounds used. But, I am unable to play all 10 levels in a shot. Game crashes in between. And If I remove sounds, game runs well and can play all levels.
I have written different lua file for sound load and play.All sounds are loaded at time in the beginning of the game and then using them whenever needed. Code is something like this :
local extension = “.mp3”;
local soundChannel
–creating table with all sounds loaded
local soundTable = {
[“sound_1”] = audio.loadSound(“sound_1”…extension),
[“sound_2”] = audio.loadSound(“sound_2”…extension),
[“sound_3”] = audio.loadSound(“sound_3”…extension),
[“sound_4”] = audio.loadSound(“sound_4”…extension)
– more 15 sounds clips loads here
}
function playSound(soundName)
soundChannel = audio.findFreeChannel()
audio.play( soundTable[soundName], {channel = soundChannel } )
return;
end
– this function is calling from different places in game
playSound(“sound_1”);
right now i am not disposing the sound b’coz these sounds are reusable.Can anybody tell what is wrong with this? And why game might be crashing?
Thanks. [import]uid: 68306 topic_id: 14903 reply_id: 314903[/import]
[import]uid: 12482 topic_id: 14903 reply_id: 55054[/import]