Class XSound
- Namespace
- OmegaEngine.Assets
- Assembly
- OmegaEngine.dll
A sound loaded from an audio file, decoded into in-memory IEEE-float samples ready for playback.
public class XSound : Asset, IReferenceCount, IDisposable, INamed, IComparable<Asset>
- Inheritance
-
objectXSound
- Implements
- Inherited Members
Constructors
XSound(WaveStream)
Loads a sound from an audio file stream.
protected XSound(WaveStream stream)
Parameters
streamWaveStreamThe audio file to load the sound from.
Remarks
This should only be called by Get(Engine, string?) to prevent unnecessary duplicates.
Properties
Format
The format of Samples (IEEE-float, SampleRate, native channel count).
public WaveFormat Format { get; }
Property Value
- WaveFormat
Samples
The decoded, interleaved IEEE-float samples at SampleRate.
public float[] Samples { get; }
Property Value
- float[]
Methods
Get(Engine, string?)
Returns a cached XSound or creates a new one if the requested ID is not cached.
public static XSound? Get(Engine engine, string? id)
Parameters
Returns
- XSound
The requested asset;
nullifidwas empty.
Remarks
Remember to call Clean() when done, otherwise this object will never be released.
Exceptions
- FileNotFoundException
The specified file could not be found.
- IOException
There was an error reading the file.
- UnauthorizedAccessException
Read access to the file is not permitted.
- InvalidDataException
The file does not contain valid sound data.