Docs / Audio

Glossary: IAudioEmitter

The members of IAudioEmitter, in alphabetical order.

Color legend plain property method event

A sound source in the world: a position, a list of clips and a chain of effects.

An interface. The emitters page shows it in context, with code.

Names are colored by what they are: a property, a method or an event; values and fields keep the plain color.

Properties

CurrentAudioPath →

string · Read-only. The path of the clip the emitter holds, empty when it holds none.

EffectLoopReturn →

EmitterReturnEffect · Read-only. Where the effect chain ends: what goes to the mix.

EffectLoopSend →

EmitterSendEffect · Read-only. Where the effect chain starts: the samples of the clip. See effect chains.

IsLooped →

bool · Whether a new random clip starts when one ends. Off by default.

LoopPauseRangeMs →

(int min, int max) · The shortest and longest silence between loops, in milliseconds. Negative values are taken as 0, and the two ends are put in order. (0, 0) by default.

Name →

string · Read-only. The name the emitter was created under, unique in its manager.

Position →

Vector3 · The emitter’s position in the world. Its positional effects follow it at once.

State →

AudioEmitterPlayingStates · Read-only. Where the emitter is: idle, playing, paused, finished, or stopped by a broken chain. Refreshed by AudioManager.Update.

TimeDuration →

TimeSpan · Read-only. The length of the current clip, zero without one.

TimePosition →

TimeSpan · Read-only. How far the current clip has played. A time position effect can also set it.

Type →

AudioEmitterTypes · Read-only. Cached or Streaming.

Methods

ClearAudioEffects() →

ClearAudioEffects() · Disposes every effect and connects the send straight to the return.

ClearAudios() →

ClearAudios() · Stops the emitter and takes every clip out.

Dispose() →

Dispose() · Stops the emitter and disposes its clips and effects. Remove emitters through the manager instead, which disposes them.

Pause() →

Pause() · Holds a playing clip where it is.

Play() →

Play() · Starts a random clip when stopped or finished, resumes when paused. Cuts short a loop pause.

Stop() →

Stop() · Ends the clip and forgets it, cancels a loop pause and clears the echoes of delay effects.

TryAddAudio() →

TryAddAudio(string path) · Adds a WAV or Ogg Vorbis clip. A cached emitter decodes it now. false for an empty path, a file the emitter has already, or one that can’t be opened or decoded.

Parameter Type Description
path string The WAV or Ogg Vorbis file to add. The emitter knows the clip by this path.

TryAddAudioEffect() →

TryAddAudioEffect(AudioEffectTypes type, out BaseAudioEffect effect) · Creates an effect of a type, not connected to anything. false for EffectLoopSend and EffectLoopReturn, and for a second Distance, Doppler, Spatial or TimePosition.

Parameter Type Description
type AudioEffectTypes The kind of effect to create.
effect out BaseAudioEffect The new effect, or null when the method returns false.

TryGetAudioEffect() →

TryGetAudioEffect(Guid effectId, out BaseAudioEffect effect) · Finds an effect of this emitter by its Id, the send and the return included.

Parameter Type Description
effectId Guid The Id of the effect.
effect out BaseAudioEffect The effect, or null when the emitter has none with that Id.

TryRemoveAudio() →

TryRemoveAudio(string path) · Takes a clip out and disposes it. When it is the clip playing, another random clip starts. false when the emitter doesn’t have it.

Parameter Type Description
path string The path the clip was added with.

TryRemoveAudioEffect() →

TryRemoveAudioEffect(BaseAudioEffect effect) · Disconnects and disposes an effect of this emitter. An effect in the chain leaves it broken until you connect its neighbors.

Parameter Type Description
effect BaseAudioEffect The effect to remove, one of this emitter’s.

TryRemoveAudioEffect(Guid effectId) · The same, for the effect with that Id.

Parameter Type Description
effectId Guid The Id of the effect to remove.

Update() →

Update(float elapsedSeconds) · Refreshes the state, runs the loop pause and measures Doppler speeds. AudioManager.Update calls it for every emitter; don’t call it yourself as well.

Parameter Type Description
elapsedSeconds float The time since the last call, in seconds, which times the loop pause and the Doppler speeds.

Events

OnCurrentAudioChanged →

(IAudioEmitter sender) · The emitter takes a clip or lets one go: on play, at every loop, on stop, and when the clip playing is removed.

Parameter Type Description
sender IAudioEmitter The emitter that raised the event.

OnStateChanged →

(IAudioEmitter sender) · State changes. From AudioManager.Update on the game thread, or from the thread that rewires the chain.

Parameter Type Description
sender IAudioEmitter The emitter that raised the event.