Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua 如何在Corona中获得系统声音?_Lua_Coronasdk - Fatal编程技术网

Lua 如何在Corona中获得系统声音?

Lua 如何在Corona中获得系统声音?,lua,coronasdk,Lua,Coronasdk,我想知道从系统中获取声音的方法。实际上,我正在制作一个报警类型的应用程序。我想获取系统声音以进行声音选择。以前我自己添加声音,效果很好。现在我想进入系统的声音。我该怎么做 我以前也这么做过 local function listButtonRelease2( event ) self2 = event.target local id = self2.id if self2.id==1 then alarm = audio.loadSound("sound4.mp3") x=

我想知道从系统中获取声音的方法。实际上,我正在制作一个报警类型的应用程序。我想获取系统声音以进行声音选择。以前我自己添加声音,效果很好。现在我想进入系统的声音。我该怎么做

我以前也这么做过

local function listButtonRelease2( event )

self2 = event.target
local id = self2.id

if  self2.id==1 then
    alarm = audio.loadSound("sound4.mp3")
    x=display.newText( "Beep", 20,190, native.systemFontBold, 14 )
    x:setTextColor(0,0,0)
    x.alpha = 0
elseif self2.id==2 then
    alarm = audio.loadSound("sound2.mp3")
    x=display.newText( "Buzzer1", 20,190, native.systemFontBold, 14 )
    x:setTextColor(0,0,0)
    x.alpha = 0 
elseif self2.id==3 then
    alarm = audio.loadSound("sound5.mp3")
    x=display.newText( "Buzzer2", 20,190, native.systemFontBold, 14 )
    x:setTextColor(0,0,0)
    x.alpha = 0
elseif self2.id==4 then
    alarm = audio.loadSound("sound3.mp3")
    x=display.newText( "Clock ticking", 20,190, native.systemFontBold, 14 )
    x:setTextColor(0,0,0)
    x.alpha = 0
else 
    x=display.newText( "Emergency", 20,190, native.systemFontBold, 14 )
    x:setTextColor(0,0,0)
    x.alpha = 0
    alarm = audio.loadSound("sound1.mp3")
    x=display.newText( "Sound 5 selected", 20,190, native.systemFontBold, 14 )
    x:setTextColor(0,0,0)
    x.alpha = 0

end
结束

请引导我


谢谢,Corona不支持这一点,特别是因为它是多平台的,所以系统声音会随着系统的变化而变化,并且没有明确的方法来说明这一点

myList2=tableView.newList{
    data=sound,
    default="listItemBg.png",
    over="listItemBg_over.png",
    onRelease=listButtonRelease2,
    top=topBoundary,
    bottom=bottomBoundary,
    callback = function( row )
        local s = display.newGroup()

        local title =  display.newText( row.title, 20, 0, native.systemFontBold, 20 )
        title:setTextColor(0, 0, 0)
        s:insert(title)
        title.y = 30

        local subtitle =  display.newText( row.subtitle, 20, 0, native.systemFont, 14 )
        subtitle:setTextColor(0,0,0)
        s:insert(subtitle)
        subtitle.y = title.y + title.height + 10

    return s   
    end 


sound[1]={}
    sound[1].title="Beep"
    sound[1].subtitle = " "

    sound[2]={}
    sound[2].title="Buzzer1"
    sound[2].subtitle = " "

    sound[3]={}
    sound[3].title="Buzzer2"
    sound[3].subtitle = " "

    sound[4]={}
    sound[4].title="Clock ticking"
    sound[4].subtitle = " "

    sound[5]={}
    sound[5].title="Emergency"
    sound[5].subtitle = " "