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
-
objectAudioElement
- Implements
- Derived
- Inherited Members
Properties
EffectiveVolume
protected float EffectiveVolume { get; }
Property Value
FadeLevel
How far the current fade has progressed: 0 = silent, 1 = the full Volume.
protected float FadeLevel { get; }
Property Value
Looping
Is this sound set to loop?
public abstract bool Looping { get; }
Property Value
Playing
Is this sound currently being played?
public abstract bool Playing { get; }
Property Value
Volume
The playback volume as a factor between 0 (silent) and 1 (normal).
public float Volume { get; set; }
Property Value
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
FadeIn(bool, AnimationOptions?)
Starts the playback silently and fades it in to the full Volume.
public void FadeIn(bool looping, AnimationOptions? options = null)
Parameters
loopingboolWhether the playback should loop.
optionsAnimationOptionsOptions controlling the fade; leave
nullfor 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
optionsAnimationOptionsOptions controlling the fade; leave
nullfor 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
loopingbool
StopPlayback()
Stops the asset playback.
public abstract void StopPlayback()