Improve audio effects handling and update spell sound filter type
This commit is contained in:
parent
fc5a39b1d2
commit
a4e2a2f257
@ -1,6 +1,8 @@
|
||||
local ease = require "lib.utils.easing"
|
||||
local AnimationNode = require "lib.animation_node"
|
||||
|
||||
local EFFECTS_SUPPORTED = love.audio.isEffectsSupported()
|
||||
|
||||
--- @alias SourceFilter { type: "bandpass"|"highpass"|"lowpass", volume: number, highgain: number, lowgain: number }
|
||||
|
||||
--- @class Audio
|
||||
@ -62,19 +64,20 @@ end
|
||||
--- @param settings SourceFilter?
|
||||
--- @param effectName string?
|
||||
function audio:play(source, settings, effectName)
|
||||
if settings then
|
||||
source:setFilter(settings)
|
||||
end
|
||||
if effectName then
|
||||
source:setEffect(effectName, true)
|
||||
end
|
||||
if source:getType() == "stream" then
|
||||
source:setLooping(self.looped)
|
||||
source:setVolume(self.musicVolume)
|
||||
return source:play()
|
||||
end
|
||||
source:play()
|
||||
else
|
||||
source:setVolume(self.soundVolume)
|
||||
return source:play()
|
||||
source:play()
|
||||
end
|
||||
if settings and EFFECTS_SUPPORTED then
|
||||
source.setFilter(source, settings)
|
||||
end
|
||||
if effectName and EFFECTS_SUPPORTED then
|
||||
source:setEffect(effectName, true)
|
||||
end
|
||||
end
|
||||
|
||||
function audio:setMusicVolume(volume)
|
||||
|
||||
@ -172,9 +172,8 @@ function attack:cast(caster, target)
|
||||
targetSprite:animate("hurt", node)
|
||||
--- @type SourceFilter
|
||||
local settings = {
|
||||
type = "bandpass",
|
||||
type = "highpass",
|
||||
volume = 1,
|
||||
highgain = 0.1,
|
||||
lowgain = 0.1
|
||||
}
|
||||
Tree.audio:play(audioPath.sounds.hurt, settings)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user