mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-22 21:46:51 +02:00
This commit is contained in:
@@ -154,8 +154,14 @@ local function newSfxSource(data, key, def, pitch, tempo, plain)
|
||||
return newFileSource(def)
|
||||
end
|
||||
|
||||
local function deviceSuspended()
|
||||
local ChipAudio = package.loaded["src.core.ChipAudio"]
|
||||
return ChipAudio ~= nil and ChipAudio.isSuspended()
|
||||
end
|
||||
|
||||
local function playPath(data, key, def, pitch, tempo, plain)
|
||||
if not love.audio or not def then return nil end
|
||||
if deviceSuspended() then return nil end
|
||||
local src = cache[key]
|
||||
if src == false then return nil end -- known bad, already logged
|
||||
if not src then
|
||||
@@ -602,6 +608,7 @@ end
|
||||
-- cache carries no clips (Red/Blue) or headless.
|
||||
function Sound.playPikaCry(data, n)
|
||||
if not love.audio then return nil end
|
||||
if deviceSuspended() then return nil end
|
||||
local count = data.audio and data.audio.pikaCries
|
||||
if not count then return nil end
|
||||
n = math.max(1, math.min(count, n or 1))
|
||||
@@ -633,6 +640,7 @@ end
|
||||
-- like the original's PlayCry -> WaitForSoundToFinish can poll it
|
||||
function Sound.playCry(data, species, pikaClip)
|
||||
if not love.audio then return nil end
|
||||
if deviceSuspended() then return nil end
|
||||
-- Yellow voices every Pikachu cry with the PCM clips (the chip cry is
|
||||
-- never used for the species there). Which clip is a property of the
|
||||
-- call site in the original -- every caller of PlayPikachuSoundClip sets
|
||||
|
||||
Reference in New Issue
Block a user