added filters to audio:play
This commit is contained in:
parent
ae03ee3adb
commit
70ec74ebe3
@ -1,6 +1,8 @@
|
||||
local ease = require "lib.utils.easing"
|
||||
local AnimationNode = require "lib.animation_node"
|
||||
|
||||
--- @alias SourceFilter { type: "bandpass"|"highpass"|"lowpass", volume: number, highgain: number, lowgain: number }
|
||||
|
||||
--- @class Audio
|
||||
--- @field musicVolume number
|
||||
--- @field soundVolume number
|
||||
@ -60,7 +62,11 @@ function audio:crossfade(from, to, ms)
|
||||
end
|
||||
|
||||
--- @param source love.Source
|
||||
function audio:play(source)
|
||||
--- @param settings SourceFilter?
|
||||
function audio:play(source, settings)
|
||||
if settings then
|
||||
source:setFilter(settings)
|
||||
end
|
||||
if source:getType() == "stream" then
|
||||
source:setLooping(self.looped)
|
||||
source:setVolume(self.musicVolume)
|
||||
|
||||
@ -148,8 +148,14 @@ function attack:cast(caster, target)
|
||||
function(node)
|
||||
local audioPath = Tree.assets.files.audio
|
||||
targetSprite:animate("hurt", node)
|
||||
-- Tree.assets.files.audio.sounds.hurt:play()
|
||||
Tree.audio:play(audioPath.sounds.hurt)
|
||||
--- @type SourceFilter
|
||||
local settings = {
|
||||
type = "bandpass",
|
||||
volume = 1,
|
||||
highgain = 0.1,
|
||||
lowgain = 0.1
|
||||
}
|
||||
Tree.audio:play(audioPath.sounds.hurt, settings)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user