s&box docs

public class Sandbox.SoundFile : Sandbox.Resource

A sound resource.

Methods

Showing 14 methods

protected virtual override void Finalize()

public System.Threading.Tasks.Task`1<short[]> GetSamplesAsync()

Request decompressed audio samples.

public static Sandbox.SoundFile Load(string filename)

Load a new sound from disk. Includes automatic caching.

Parameters

  • filename: The file path to load the sound from.

Returns

The loaded sound file, or null if failed.

public System.Threading.Tasks.Task`1<bool> LoadAsync()

public void Preload()

Properties

Showing 11 properties

public int Sandbox.SoundFile.BitsPerSample { get; set; }

Bits per each sample of this sound file.

public int Sandbox.SoundFile.BytesPerSample { get; set; }

Bytes per each sample of this sound file.

public int Sandbox.SoundFile.Channels { get; set; }

Number of channels this audio file has.

public float Sandbox.SoundFile.Duration { get; set; }

Duration of the sound this sound file contains, in seconds.

public bool Sandbox.SoundFile.IsLoaded { get; set; }

true if sound is loaded

public virtual bool Sandbox.SoundFile.IsValid { get; set; }

public bool Sandbox.SoundFile.IsValidForPlayback { get; set; }

public System.Action Sandbox.SoundFile.OnSoundReloaded { get; set; }

Ran when the file is reloaded/recompiled, etc.

public int Sandbox.SoundFile.Rate { get; set; }

Sample rate of this sound file, per second.

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.

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.SoundFile

On this page

Methodsprotected virtual override System.Void Finalize()public static Sandbox.SoundFile FromMp3(System.String filename, System.Span`1<System.Byte> data, Sandbox.SoundFile.LoadOptions options = null)public static Sandbox.SoundFile FromMp3(System.String filename, System.Span`1<System.Byte> data, System.Boolean loop)public static Sandbox.SoundFile FromMp3(System.String filename, System.Span`1<System.Byte> data, System.Int32 loopStart, System.Int32 loopEnd)public static Sandbox.SoundFile FromPcm(System.String filename, System.Span`1<System.Byte> data, Sandbox.SoundFile.PcmOptions options = null)public static Sandbox.SoundFile FromPcm(System.String filename, System.Span`1<System.Byte> data, System.Int32 channels, System.UInt32 rate, System.Int32 bits, System.Boolean loop)public static Sandbox.SoundFile FromPcm(System.String filename, System.Span`1<System.Byte> data, System.Int32 channels, System.UInt32 rate, System.Int32 bits, System.Int32 loopStart, System.Int32 loopEnd)public static Sandbox.SoundFile FromWav(System.String filename, System.Span`1<System.Byte> data, Sandbox.SoundFile.LoadOptions options = null)public static Sandbox.SoundFile FromWav(System.String filename, System.Span`1<System.Byte> data, System.Boolean loop)public static Sandbox.SoundFile FromWav(System.String filename, System.Span`1<System.Byte> data, System.Int32 loopStart, System.Int32 loopEnd)public System.Threading.Tasks.Task`1<System.Int16[]> GetSamplesAsync()public static Sandbox.SoundFile Load(System.String filename)public System.Threading.Tasks.Task`1<System.Boolean> LoadAsync()public System.Void Preload()Propertiespublic System.Int32 Sandbox.SoundFile.BitsPerSample { get; set; }public System.Int32 Sandbox.SoundFile.BytesPerSample { get; set; }public System.Int32 Sandbox.SoundFile.Channels { get; set; }public System.Single Sandbox.SoundFile.Duration { get; set; }public Sandbox.SoundFormat Sandbox.SoundFile.Format { get; set; }public System.Boolean Sandbox.SoundFile.IsLoaded { get; set; }public virtual System.Boolean Sandbox.SoundFile.IsValid { get; set; }public System.Boolean Sandbox.SoundFile.IsValidForPlayback { get; set; }public System.Action Sandbox.SoundFile.OnSoundReloaded { get; set; }public System.Int32 Sandbox.SoundFile.Rate { get; set; }public System.Int32 Sandbox.SoundFile.SampleFrameSize { get; set; }Metadata