Class AudioManager
- Namespace
- OmegaEngine.Audio
- Assembly
- OmegaEngine.dll
public sealed class AudioManager : IDisposable
- Inheritance
-
objectAudioManager
- 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
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
MusicVolume
public float MusicVolume { get; set; }
Property Value
SoundVolume
public float SoundVolume { get; set; }
Property Value
Methods
AddInput(ISampleProvider, AudioCategory, Action?)
Adds a sample provider to the mixer.
public bool AddInput(ISampleProvider provider, AudioCategory category, Action? onEnded = null)
Parameters
providerISampleProviderThe sample provider to play.
categoryAudioCategoryWhich volume bus to route the provider through.
onEndedActionOptional callback invoked when the provider finishes playing on its own (not via RemoveInput(ISampleProvider, AudioCategory)).
Returns
- bool
trueif the input was added;falseif 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
providerISampleProviderThe sample provider to remove.
categoryAudioCategoryThe 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()