API ReferenceSandbox
SoundFileclass
A sound resource.
Methods15
Showing 15 methods
protected virtual override void Finalize()
Returns:
void—public static Sandbox.SoundFile FromOgg(string filename, System.Span`1<byte> data, Sandbox.SoundFile.LoadOptions options = null)
| Parameter | Type | Description |
|---|---|---|
| filename | string | — |
| data | Span<byte> | — |
| options = null | LoadOptions | — |
public System.Threading.Tasks.Task`1<short[]> GetSamplesAsync()
Request decompressed audio samples.
Returns:
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()
Returns:
Task<bool>—public void Preload()
Returns:
void—No results match this filter.
Properties11
Showing 11 properties
public int Sandbox.SoundFile.BitsPerSample { get; set; }
Bits per each sample of this sound file.
Returns:
int—public int Sandbox.SoundFile.BytesPerSample { get; set; }
Bytes per each sample of this sound file.
Returns:
int—public int Sandbox.SoundFile.Channels { get; set; }
Number of channels this audio file has.
Returns:
int—public float Sandbox.SoundFile.Duration { get; set; }
Duration of the sound this sound file contains, in seconds.
Returns:
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
Returns:
bool—public virtual bool Sandbox.SoundFile.IsValid { get; set; }
Returns:
bool—public bool Sandbox.SoundFile.IsValidForPlayback { get; set; }
Returns:
bool—public System.Action Sandbox.SoundFile.OnSoundReloaded { get; set; }
Ran when the file is reloaded/recompiled, etc.
Returns:
Action—public int Sandbox.SoundFile.Rate { get; set; }
Sample rate of this sound file, per second.
Returns:
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.
Returns:
int—No results match this filter.