我怎样在Corona中获取系统声音?

我想知道如何从系统中获取声音。实际上,我正在制作一种报警类应用程序。我想要获取系统声音以进行声音选择。以前我自己添加声音,这很好用。现在我想访问系统声音。我怎么做?

我以前是这样做的。

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( "选择声音5"20,190,native.systemFontBold,14)
    x:setTextColor(0,0,0)
    x.alpha = 0
end

end

myList2 = tableView.newList {
    data = sound,
    default = "listItemBg.png",
    over = "listItemBg_over.png",
    onRelease = listButtonRelease2,
    top = topBoundary,
    bottom = bottomBoundary,
    callback = functionrow)
        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 = "嘟"
    sound [1] .subtitle = ""

    sound [2] = {}
    sound [2] .title = "蜂鸣器1"
    sound [2] .subtitle = ""

    sound [3] = {}
    sound [3] .title = "蜂鸣器2"
    sound [3] .subtitle = ""

    sound [4] = {}
    sound [4] .title = "时钟嘀嗒"
    sound [4] .subtitle = ""

    sound [5] = {}
    sound [5] .title = "紧急情况"
    sound [5] .subtitle = ""

请指导我。

谢谢

点赞
用户269870
用户269870

Corona不支持这个特性,特别是因为它是一个跨平台的软件,所以系统声音会随系统而变化,并且没有明确的方法去解决这个问题。

2013-01-31 17:47:21