Back
· 2 min read
Audio buses and positional audio
Audio buses as a tree of gains a sound plays through, a volume slider that moves everything on a bus, and positional audio from a listener.
- Dragos Balaur
Audio buses are a tree of gains a sound plays through, every chain ending at
master. One volume moves everything on a bus, and a listener gives
positional audio.
- Buses are declared in
project.toml. A sound's gain is its own volume times every bus's up to the root, soaudio::set_bus_volume("music", 0.3)moves every piece of music at once and nothing else.masterexists whether or not the project declares it. - A bus does not own a sound. Routing is per playback: one file is a
footstep on
sfxand a menu click onui. audio::play_event(name, options)plays a named sound: the next of its variations in turn, at its own volume and pitch, through its own bus. Apositionin the options places it.- A
listenernode is the ears, oraudio::set_listenerputs them somewhere by hand.set_emitter_positionmoves what a handle plays from, anddistance_gainsays what the distance is costing.
[audio.buses]
sfx = { volume = 0.9 }
music = { volume = 0.6 }
ui = { volume = 1.0, parent = "sfx" }
There are no effects and no sends. The audio module is in the
script modules reference.