s&box docs

public class Sandbox.SoundFile : Sandbox.Resource

A sound resource.

Methods

Showing 8 methods

protected virtual override void Finalize()

public static Sandbox.SoundFile FromMp3(string filename, System.Span`1<byte> data, bool loop)

public static Sandbox.SoundFile FromPcm(string filename, System.Span`1<byte> data, int channels, uint rate, int bits, bool loop)

public static Sandbox.SoundFile FromWav(string filename, System.Span`1<byte> data, bool loop)

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