Sound class Audio

Manages an audio resource, its loading state, and playback properties.

This class handles loading audio from a file or raw byte data, decoding it using the Web Audio API's AudioContext, and storing the decoded AudioBuffer. It also tracks the LoadingState.

Constructors

Sound()

Properties

buffer AudioBuffer?
The decoded audio data.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
lastTimePlayed DateTime?
The DateTime when the sound was last played.
getter/setter pair
retriggerDelay Duration
The minimum Duration that must pass before this sound can be played again.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state LoadingState
The current loading state of the sound.
getter/setter pair

Methods

dispose() → dynamic
Releases the audio resources held by this sound and resets its state.
loadFromBytes(JSArrayBuffer audioData, AudioContext audioContext) → dynamic
Asynchronously decodes audio data from a JSArrayBuffer and prepares it for playback.
loadFromFile(String path, Loader loadingInfo, AudioContext audioContext) → dynamic
Asynchronously loads a sound from a file at the given path.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited