Table of Contents

Class AudioElement

Namespace
OmegaEngine.Audio
Assembly
OmegaEngine.dll

A common base class for audio playback that can be faded in and out.

public abstract class AudioElement : EngineElement, IDisposable, IAudio
Inheritance
object
AudioElement
Implements
Derived
Inherited Members

Properties

EffectiveVolume

The volume actually handed to the sample providers, i.e. Volume scaled by FadeLevel.

protected float EffectiveVolume { get; }

Property Value

float

FadeLevel

How far the current fade has progressed: 0 = silent, 1 = the full Volume.

protected float FadeLevel { get; }

Property Value

float

Looping

Is this sound set to loop?

public abstract bool Looping { get; }

Property Value

bool

Playing

Is this sound currently being played?

public abstract bool Playing { get; }

Property Value

bool

Volume

The playback volume as a factor between 0 (silent) and 1 (normal).

public float Volume { get; set; }

Property Value

float

Methods

ApplyVolume()

Applies the current EffectiveVolume to the active playback (if any).

protected abstract void ApplyVolume()

CancelFade(bool)

Aborts any fade in progress, leaving the playback itself untouched.

protected void CancelFade(bool resetLevel = true)

Parameters

resetLevel bool

Whether to jump back to the full Volume.

FadeIn(bool, AnimationOptions?)

Starts the playback silently and fades it in to the full Volume.

public void FadeIn(bool looping, AnimationOptions? options = null)

Parameters

looping bool

Whether the playback should loop.

options AnimationOptions

Options controlling the fade; leave null for the default duration.

Remarks

Safe to call repeatedly, e.g. once per frame; playback is never restarted while it is already running. Fading back in while a FadeOut(AnimationOptions?) is still in progress simply reverses the fade, so the playback continues uninterrupted.

FadeOut(AnimationOptions?)

Fades the playback out to silence and then stops it.

public void FadeOut(AnimationOptions? options = null)

Parameters

options AnimationOptions

Options controlling the fade; leave null for the default duration.

Remarks

Safe to call repeatedly, e.g. once per frame.

StartPlayback(bool)

Starts the asset playback.

public abstract void StartPlayback(bool looping)

Parameters

looping bool

StopPlayback()

Stops the asset playback.

public abstract void StopPlayback()