ReloadPlugin("LuaAudio")
local intro = tonumber(GetVariable("intro") or "")
if not intro or ppi.isPlaying(intro) == 0 then
temp = ppi.play(dir.."sounds/ogg/music/IntroMusic/DefaultIntro.ogg", 1, 0, 40)
SetVariable("intro", temp)
end
temp=GetVariable("intro")
ppi.stop(temp)
temp=GetVariable("intro")
ppi.stop(temp)
action="%1"
path="%2"
volume="%3"
pitch="%4"
pan="%5"
id="%6"
volume=tonumber(volume)
if (pitch == "na") then
pitch = -10000
else
pitch = tonumber(pitch)
pitch = (pitch - 44100) / 98
end
if (pan == "na") then
pan = -10000
else
pan = tonumber(pan)
end
if (path == "na") then
if (action == "adjustsound") then
temp = GetVariable(id)
if volume and volume > -1 then
ppi.setVol(volume, temp)
end
if (pitch > -10000) then
ppi.setPitch(pitch, temp)
end
if (pan > -10000) then
ppi.setPan(pan, temp)
end
elseif (action == "stop") then
temp = GetVariable(id)
if temp then
ppi.stop(temp)
end
end
else
local sound_path = dir .. "sounds/ogg/" .. path .. ".ogg"
local file = io.open(sound_path, "r")
if file then
file:close()
play_sound_now(path, action, pan, volume, pitch, id)
else
download_sound(path, action, pan, volume, pitch, id)
end
end