gpt4 book ai didi

audio - CORONA SDK:随机播放声音

转载 作者:行者123 更新时间:2023-12-03 00:43:22 24 4
gpt4 key购买 nike

我正处于创建游戏的过程中,我想在播放器播放游戏时播放特定的声音,而当我的游戏通过 Storyboard 时,我会不断失去音频

-------------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)

------------------------------------

我想随机播放声音(创建一个表,然后调用随机播放的声音而不忘记延迟,因为它需要在指定的时间内播放)。

最佳答案

尝试回调侦听器:

 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 } )

关于audio - CORONA SDK:随机播放声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30466093/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com