Table of Contents

Class AudioManager

Namespace
OmegaEngine.Audio
Assembly
OmegaEngine.dll

Owns the shared NAudio output device and mixer that all Sounds and Songs feed into.

public sealed class AudioManager : IDisposable
Inheritance
object
AudioManager
Implements

Constructors

AudioManager()

Creates the output device and mixer.

public AudioManager()

Fields

MixerFormat

The wave format all mixer inputs must match: 32-bit float, stereo, SampleRate.

public static readonly WaveFormat MixerFormat

Field Value

WaveFormat

SampleRate

The sample rate all audio is mixed and played back at.

public const int SampleRate = 44100

Field Value

int

Properties

Listener

The source of the position and orientation used as the listener for positional Sound3D playback, e.g. the active View or Camera. null places the listener at the world origin.

public IViewpoint? Listener { get; set; }

Property Value

IViewpoint

MusicVolume

A global volume multiplier applied to all Song music, on top of each song's own Volume.

public float MusicVolume { get; set; }

Property Value

float

SoundVolume

A global volume multiplier applied to all Sound effects, on top of each sound's own Volume.

public float SoundVolume { get; set; }

Property Value

float

Methods

AddInput(ISampleProvider, AudioCategory, Action?)

Adds a sample provider to the mixer.

public bool AddInput(ISampleProvider provider, AudioCategory category, Action? onEnded = null)

Parameters

provider ISampleProvider

The sample provider to play.

category AudioCategory

Which volume bus to route the provider through.

onEnded Action

Optional callback invoked when the provider finishes playing on its own (not via RemoveInput(ISampleProvider, AudioCategory)).

Returns

bool

true if the input was added; false if audio is disabled.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

RemoveInput(ISampleProvider, AudioCategory)

Removes a sample provider previously added via AddInput(ISampleProvider, AudioCategory, Action?). No-op when disabled or not present.

public void RemoveInput(ISampleProvider provider, AudioCategory category)

Parameters

provider ISampleProvider

The sample provider to remove.

category AudioCategory

The same category the provider was added with.

Update()

Refreshes the snapshot taken from Listener. Must be called once per frame on the main thread.

public void Update()