Files
tromi_mobile/load/sounds.lua
Squishy (C6H12O6+NaCl+H2O) d0307c8765 first commit
2024-04-11 08:33:58 +07:00

50 lines
1.7 KiB
Lua

sounds = {
bottom = love.audio.newSource("res/se/bottom.wav", "static"),
lock = love.audio.newSource("res/se/lock.wav", "static"),
erase = love.audio.newSource("res/se/erase.wav", "static"),
fall = love.audio.newSource("res/se/fall.wav", "static"),
ready = love.audio.newSource("res/se/ready.wav", "static"),
promote = love.audio.newSource("res/se/promote.wav", "static"),
demote = love.audio.newSource("res/se/demote.wav", "static"),
autopromote = love.audio.newSource("res/se/autopromote.wav", "static"),
bgm_firsthalf = love.audio.newSource("res/bgm/firsthalf.flac", "static"),
bgm_secondhalf = love.audio.newSource("res/bgm/secondhalf.flac", "static"),
bgm_title = love.audio.newSource("res/bgm/title.flac", "static")
}
function playSE(sound, subsound)
if sound ~= nil then
if subsound ~= nil then
sounds[sound][subsound]:setVolume(0.4)
if sounds[sound][subsound]:isPlaying() then
sounds[sound][subsound]:stop()
end
sounds[sound][subsound]:play()
else
sounds[sound]:setVolume(0.4)
if sounds[sound]:isPlaying() then
sounds[sound]:stop()
end
sounds[sound]:play()
end
end
end
function playSEOnce(sound, subsound)
if sound ~= nil then
if subsound ~= nil then
sounds[sound][subsound]:setVolume(0.4)
if sounds[sound][subsound]:isPlaying() then
return
end
sounds[sound][subsound]:play()
else
sounds[sound]:setVolume(0.4)
if sounds[sound]:isPlaying() then
return
end
sounds[sound]:play()
end
end
end