Table of Contents

Class Sound

Namespace
OmegaEngine.Audio
Assembly
OmegaEngine.dll

A memory-cached sound that is played on-demand.

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

Constructors

Sound(XSound)

Sets up a new Sound based on an XSound asset.

public Sound(XSound sound)

Parameters

sound XSound

The XSound asset to get the audio data from.

Fields

Asset

A reference to the asset providing the data for this sound.

protected readonly XSound Asset

Field Value

XSound

Properties

Looping

Is this sound set to loop?

public bool Looping { get; }

Property Value

bool

Playing

Is this sound currently being played?

public 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 Volume to the active playback (if any).

protected virtual void ApplyVolume()

CreatePlaybackChain(bool)

Builds the chain of sample providers feeding the mixer for a single playback.

protected virtual ISampleProvider CreatePlaybackChain(bool looping)

Parameters

looping bool

Whether the playback should loop.

Returns

ISampleProvider

The top-level sample provider (stereo, SampleRate, IEEE-float).

OnDispose()

Hook that is called when the object needs to dispose its internal resources.

protected override void OnDispose()

StartPlayback(bool)

Starts the sound playback

public virtual void StartPlayback(bool looping)

Parameters

looping bool

StopPlayback()

Stops the sound playback

public virtual void StopPlayback()