AudioPlayer.playAudio=function(l)if not l then warn("\067\111\117\108\100 \110\111\116 \102\105\110\100 \097\117\100\105\111 \097\115\115\101\116\058 "..l)return end if not l.IsLoaded then l.Loaded:wait()end l:Play()end AudioPlayer.pauseAudio=function(l)if l.IsPlaying then AudioPlayer.reduceVolume(l,0)l:Pause()end end AudioPlayer.resumeAudio=function(l)if l.IsPaused then l:Resume()AudioPlayer.increaseVolume(l,.5)end end AudioPlayer.reduceVolume=function(l,d)for d=l.Volume,d,-0.02 do l.Volume=d wait()end end AudioPlayer.increaseVolume=function(l,d)for d=0,d,.02 do l.Volume=d wait()end end AudioPlayer.getCurrentlyPlaying=function(l)for l,d in ipairs(l)do if d.IsPlaying then return d end end end AudioPlayer.getCurrentlyPaused=function(l)for l,d in ipairs(l)do if d.IsPaused and d.TimePosition>0 then return d end end end return AudioPlayer

AudioPlayer.playAudio = function(asset)
	if not asset then
		warn("Could not find audio asset: " .. asset)
		return
	end
	if not asset.IsLoaded then
		asset.Loaded:wait()
	end
	asset:Play()
end

AudioPlayer.pauseAudio = function(asset) 
	if asset.IsPlaying then
		AudioPlayer.reduceVolume(asset, 0)
		asset:Pause()
	end
end

AudioPlayer.resumeAudio = function(asset) 
	if asset.IsPaused then
		asset:Resume()
		AudioPlayer.increaseVolume(asset, 0.5)
	end
end

AudioPlayer.reduceVolume = function(asset, goalVolume) 
	for i = asset.Volume, goalVolume, -0.02 do
		asset.Volume = i
		wait()
	end 
end

AudioPlayer.increaseVolume = function(asset, goalVolume) 
	for i = 0, goalVolume, 0.02 do
		asset.Volume = i
		wait()
	end 
end

AudioPlayer.getCurrentlyPlaying = function(assets)
	for _, asset in ipairs(assets) do
		if asset.IsPlaying then
			return asset
		end
	end
end

AudioPlayer.getCurrentlyPaused = function(assets)
	for _, asset in ipairs(assets) do
		if asset.IsPaused and asset.TimePosition > 0 then
			return asset
		end
	end
end

return AudioPlayer
