mirror of
https://github.com/TangentFoxy/slam.git
synced 2024-11-14 10:24:21 +00:00
Unclobbered love.audio stuff, moved into slam.audio
I don't know if this will actually work or if I have broken it.
This commit is contained in:
parent
c19dccec48
commit
4747db163d
16
slam.lua
16
slam.lua
@ -1,4 +1,4 @@
|
|||||||
-- Simple LÖVE Audio Manager
|
-- Simple LÖVE Audio Manager
|
||||||
--
|
--
|
||||||
-- Copyright (c) 2011 Matthias Richter
|
-- Copyright (c) 2011 Matthias Richter
|
||||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@ -104,13 +104,13 @@ end
|
|||||||
|
|
||||||
function Source:addTags(tag, ...)
|
function Source:addTags(tag, ...)
|
||||||
if not tag then return end
|
if not tag then return end
|
||||||
love.audio.tags[tag][self] = self
|
slam.audio.tags[tag][self] = self
|
||||||
return Source.addTags(self, ...)
|
return Source.addTags(self, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Source:removeTags(tag, ...)
|
function Source:removeTags(tag, ...)
|
||||||
if not tag then return end
|
if not tag then return end
|
||||||
love.audio.tags[tag][self] = nil
|
slam.audio.tags[tag][self] = nil
|
||||||
return Source.removeTags(self, ...)
|
return Source.removeTags(self, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ Source.isLooping = Source.getLooping
|
|||||||
--------------------------
|
--------------------------
|
||||||
-- love.audio interface --
|
-- love.audio interface --
|
||||||
--------------------------
|
--------------------------
|
||||||
function love.audio.newSource(target, how)
|
function slam.audio.newSource(target, how)
|
||||||
local s = {
|
local s = {
|
||||||
_paused = false,
|
_paused = false,
|
||||||
target = target,
|
target = target,
|
||||||
@ -150,16 +150,16 @@ function love.audio.newSource(target, how)
|
|||||||
if how == 'static' and type(target) == 'string' then
|
if how == 'static' and type(target) == 'string' then
|
||||||
s.target = love.sound.newSoundData(target)
|
s.target = love.sound.newSoundData(target)
|
||||||
end
|
end
|
||||||
love.audio.tags.all[s] = s
|
slam.audio.tags.all[s] = s
|
||||||
return setmetatable(s, Source)
|
return setmetatable(s, Source)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.audio.play(source)
|
function slam.audio.play(source)
|
||||||
assert(source and source.instances, "Can only play source objects.")
|
assert(source and source.instances, "Can only play source objects.")
|
||||||
return source:play()
|
return source:play()
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.audio.stop(source)
|
function slam.audio.stop(source)
|
||||||
if source and source.stop then return source:stop() end
|
if source and source.stop then return source:stop() end
|
||||||
stop()
|
stop()
|
||||||
end
|
end
|
||||||
@ -178,7 +178,7 @@ function Tag:__index(func)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
love.audio.tags = setmetatable({}, {
|
slam.audio.tags = setmetatable({}, {
|
||||||
__newindex = error,
|
__newindex = error,
|
||||||
__index = function(t,k)
|
__index = function(t,k)
|
||||||
local tag = setmetatable({}, Tag)
|
local tag = setmetatable({}, Tag)
|
||||||
|
Loading…
Reference in New Issue
Block a user