You would want to reserve a channel just for that sound. Then before playing the sound on that channel, check if the channel is still playing. If it’s not, then go ahead and play the sound, otherwise don’t. Having the sound in a single object isn’t neccessary.
Something like this:
[code]
function PlaySound(snd, chan)
if chan ~= nil then – check for a channel parameter
if audio.isChannelPlaying(chan) == false then – check if channel is playing
audio.play(snd, {channel=chan}) – play on specific channel
end
else
audio.play(snd) – no channel parameter, play like normal
end
end
audio.reserveChannels(1) – channel 1 is now locked for specific usage
mySound1 = audio.loadSound(sound1.mp3)
mySound2 = audio.loadSound(sound1.mp3)
PlaySound(mySound1,1) – will play like normal
PlaySound(mySound2,1) – will do nothing because mySound1 is still playing
[code] [import]uid: 56820 topic_id: 35840 reply_id: 142558[/import]