Expand description

Distinct audio playback channels for music and sound effects

Voxygen’s audio system uses a limited number of channels to play multiple sounds simultaneously. Each additional channel used decreases performance in-game, so the amount of channels utilized should be kept to a minimum.

When constructing a new AudioFrontend, two music channels are created internally (to achieve crossover fades) while the number of sfx channels are determined by the num_sfx_channels value defined in the client AudioSettings

When the AudioFrontend’s emit_sfx methods is called, it attempts to retrieve an SfxChannel for playback. If the channel capacity has been reached and all channels are occupied, a warning is logged, and no sound is played.

Structs

  • A AmbientChannel uses a non-positional audio sink designed to play sounds which are always heard at the camera’s position.
  • An iterator over the variants of Self
  • A MusicChannel uses a non-positional audio sink designed to play music which is always heard at the player’s position.
  • An SfxChannel uses a positional audio sink, and is designed for short-lived audio which can be spatially controlled, but does not need control over playback or fading/transitions
  • An UiChannel uses a non-spatial audio sink, and is designed for short-lived audio which is not spatially controlled, but does not need control over playback or fading/transitions

Enums

  • AmbientChannelTags are used for non-positional sfx. Currently the only use is for wind.
  • Each MusicChannel has a MusicChannelTag which help us determine when we should transition between two types of in-game music. For example, we transition between TitleMusic and Exploration when a player enters the world by crossfading over a slow duration. In the future, transitions in the world such as Exploration -> BossBattle would transition more rapidly.