Api Sandbox SoundFile
class

SoundFile

public class SoundFile : Resource

A sound resource.

Properties

Name Type Description
OnSoundReloaded Action Ran when the file is reloaded/recompiled, etc.
IsLoaded Boolean true if sound is loaded
Format SoundFormat Format of the audio file.
BitsPerSample Int32 Bits per each sample of this sound file.
Channels Int32 Number of channels this audio file has.
BytesPerSample Int32 Bytes per each sample of this sound file.
SampleFrameSize Int32 Size of one sample, typically this would be "sample size * channel count", but can vary on audio format.
Rate Int32 Sample rate of this sound file, per second.
Duration Single Duration of the sound this sound file contains, in seconds.
IsValid virtual Boolean
IsValidForPlayback Boolean

Methods

static SoundFile Load(String filename)

Load a new sound from disk. Includes automatic caching.

filename — The file path to load the sound from.
returns — The loaded sound file, or null if failed.
static SoundFile FromWav(String filename, Span<Byte> data, Boolean loop)
Task<Boolean> LoadAsync()
Void Preload()
Task<Int16[]> GetSamplesAsync()

Request decompressed audio samples.

Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.SoundFile