This isn’t an exact solution but I’ve built a little sound queue. You could modify it to send a done message back to the sender. To use it just create a new game object (sound.go) and attach all the wav files and the following script. Then to play it just:
msg.post("sounds", "play", { wav='boom'})
local head = nil
local tail = nil
function init(self)
self.timer = 1
end
function update(self, dt)
self.timer = self.timer + dt
if self.timer < 1 then
return
end
self.timer = 0
if ( not (sound.is_music_playing()) and not( head == nil ) ) then
msg.post( "#"..head.wav , "play_sound" , { gain = 1.0 } )
print("Playing ",head.wav)
head = head.next
if ( head == nil ) then
tail = nil
end
pprint( head )
end
end
function on_message(self, message_id, message, sender)
print("sounds.script",message_id)
if ( message_id == hash("play") ) then
local next = {}
next.wav = message.wav
if ( tail == nil ) then
head = next
tail = next
else
tail.next = next
tail = next
end
pprint( head )
end
end