Skip to content

Audio class reference

Alan Stagner edited this page Jun 9, 2020 · 1 revision

Methods

SoundEffectInstance Play(SoundEffect cue, AudioBus bus = null)
SoundEffectInstance Play(SoundEffect cue, double delaySeconds, AudioBus bus = null)

Play a sound effect with an optional delay through the given audio bus, returning a handle to the new playing instance. Passing null for the audio bus automatically routes the sound through the master audio bus


SoundEffectInstance Play3D(SoundEffect cue, Vec3 position, AudioBus bus = null)
SoundEffectInstance Play3D(SoundEffect cue, Vec3 position, double delaySeconds, AudioBus bus = null)

Same as Play, but plays the sound at the given position with 3D spatialization enabled.


SoundEffectInstance PlaySong(Song song, AudioBus bus = null) - Plays the given Song structure and returns a handle to the playing instance. Songs can have an optional non-looping intro SoundEffect and a looping SoundEffect.

Properties

Vec3 ListenerPosition { get; set; } - Gets or sets the listener position, which affects the distance attenuation and panning of 3D sounds


Vec3 ListenerForward { get; set; } - Gets or sets the forward vector of the listener, which affects the panning of 3D sounds


Vec3 ListenerUp { get; set; } - Gets or sets the up vector of the listener, which affects the panning of 3D sounds


Vec3 ListenerVelocity { get; set; } - Gets or sets the current velocity of the listener, which results in the doppler effect for pitch-shifting 3D sounds


float SpeedOfSound { get; set; } - Gets or sets the global speed of sound. Affects the scale of doppler effect pitch shifting.


AudioBus MasterBus { get; } - Gets the global master bus