我正在创建一个游戏,我希望在玩家玩游戏时播放特定声音我在游戏通过故事板时不断丢失音频
-------------AUDIO STUFF-----
------------SOUND 1-------------
colsound = audio.loadSound("crowd.mp3")
function playSound( event)
audio.play(colsound)
end
timer.performWithDelay(1000, playSound)
------------SOUND 2-------------
crowd = audio.loadSound("applause.wav")
function playSound1(event)
audio.play(crowd)
end
timer.performWithDelay(2000, playSound1)
------------------------------------
我想随机播放声音(创建一个表然后调用随机播放的声音,而不会忘记延迟,因为它需要在指定的时间播放)。
答案 0 :(得分:1)
尝试回调侦听器:
local function narrationFinished( event )
print( "Narration Finished on channel", event.channel )
if ( event.completed ) then
print( "Narration completed playback naturally" )
else
print( "Narration was stopped before completion" )
end
end
local narrationChannel = audio.play( narrationSpeech, { duration=30000, onComplete=narrationFinished } )