If you don't want to use sound spatialization, just ignore this property
audio.cone read/write property
Get or set the listener cone, that controls how sound is attenuated based on the listener's direction
This property expects a table with the fields inangle
, outangle
, outgain
set, representing the coordinates in space where the head of the listener is pointing at.
The default cone value is { outangle = 6.283185005188, inangle = 6.283185005188, outgain = 0.0 }
Example
local audio = require "audio"
local console = require "console"
local function printvector(v)
-- Fancy formatting
console.writecolor("brightwhite", "Listener "..v..(#v < 7 and ":\t\t" or " :\t"))
local value = "{ "
for axis, val in pairs(audio[v]) do
value = value..axis.." = "..val..", "
end
value = value:gsub(", $", " }")
console.writecolor("cyan", value.."\n")
end
-- Get default listener position, direction, veolocity, cone and cone
printvector("position")
printvector("direction")
printvector("velocity")
printvector("worldup")
printvector("cone")