SoundFileclass
A sound resource.
Methods16
Showing 16 methods
protected virtual override void Finalize()
void—public static Sandbox.SoundFile FromOgg(string filename, System.Span`1<byte> data, System.Nullable`1<Sandbox.SoundFile.LoadOptions> loadOptions = null)
| Parameter | Type | Description |
|---|---|---|
| filename | string | — |
| data | Span<byte> | — |
| loadOptions = null | Nullable<LoadOptions> | — |
public System.Threading.Tasks.Task`1<short[]> GetSamplesAsync()
Request decompressed audio samples. Multi-channel sounds are downmixed to mono.
Task<short[]>—public System.Threading.Tasks.Task`1<short[]> GetSamplesInterleavedAsync()
Request decompressed audio samples. Stereo sounds keep both channels, interleaved (L,R,L,R..). Sounds with any other channel count are downmixed to mono.
Task<short[]>—public static Sandbox.SoundFile Load(string filename)
Load a new sound from disk. Includes automatic caching.
| Parameter | Type | Description |
|---|---|---|
| filename | string | The file path to load the sound from. |
public System.Threading.Tasks.Task`1<bool> LoadAsync()
Task<bool>—public void Preload()
void—No results match this filter.
Properties12
Showing 12 properties
public int Sandbox.SoundFile.BitsPerSample { get; set; }
Bits per each sample of this sound file.
int—public int Sandbox.SoundFile.BytesPerSample { get; set; }
Bytes per each sample of this sound file.
int—public int Sandbox.SoundFile.Channels { get; set; }
Number of channels this audio file has.
int—public float Sandbox.SoundFile.Duration { get; set; }
Duration of the sound this sound file contains, in seconds.
float—public Sandbox.SoundFormat Sandbox.SoundFile.Format { get; set; }
Format of the audio file.
public bool Sandbox.SoundFile.IsLoaded { get; set; }
true if sound is loaded
bool—public virtual bool Sandbox.SoundFile.IsValid { get; set; }
bool—public bool Sandbox.SoundFile.IsValidForPlayback { get; set; }
bool—public int Sandbox.SoundFile.Rate { get; set; }
Sample rate of this sound file, per second.
int—public int Sandbox.SoundFile.SampleFrameSize { get; set; }
Size of one sample, typically this would be "sample size * channel count", but can vary on audio format.
int—public Sandbox.SubtitleTrack Sandbox.SoundFile.Subtitles { get; set; }
The subtitle track for this sound, or null if it doesn't have one. Authored in the sound editor's timeline as individual words, so you can show them word by word as the sound plays. Read from the compiled file when the sound resource loads - check `Sandbox.SoundFile.IsValidForPlayback` to tell "no track" apart from "not loaded yet".
public Sandbox.VisemeTrack Sandbox.SoundFile.Visemes { get; set; }
The lipsync track for this sound, or null if it doesn't have one. Authored in the sound editor's viseme timeline. Read from the compiled file when the sound resource loads - check `Sandbox.SoundFile.IsValidForPlayback` to tell "no track" apart from "not loaded yet".
No results match this filter.