Sound.cone read/write property


Get or set the sound cone, that controls how sound is attenuated based on the Sound's direction

This property expects a table with the fields inangle, outangle, outgain set, representing the coordinates in space where the head of the sound is pointing at. The default cone value is { outangle = 6.283185005188, inangle = 6.283185005188, outgain = 0.0 }

If you don't want to use sound spatialization, just ignore this property

Example

local audio = require "audio" local console = require "console" local sound = audio.Sound("music.mp3") local function printvector(v) -- Fancy Formatting console.writecolor("brightwhite", "sound "..v..(#v < 7 and ":\t\t" or " :\t")) local value = "{ " for axis, val in pairs(sound[v]) do value = value..axis.." = "..val..", " end value = value:gsub(", $", " }") console.writecolor("cyan", value.."\n") end -- Get default listener position, direction, veolocity, worldup and cone printvector("position") printvector("direction") printvector("velocity") printvector("worldup") printvector("cone")