AudioRingSink class

An AudioWorklet playing from shared memory.

Properties

buffered → Duration
How much audio is buffered: the margin a stalled producer still has.
no setter
contextSampleRate → int
The rate the audio graph is actually running at. Equal to the ring's sample rate by construction — open declines rather than return a sink where these differ, because that difference is a pitch shift.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isRunning → bool
Whether the audio context is running (an unresumed context is silent).
no setter
ring → SharedAudioRing
The ring to fill. Hand SharedAudioRing.shareable to the producer thread and rebuild it there with SharedAudioRing.attach.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
underruns → int
Frames the audio thread wanted and could not have. Non-zero means the producer fell behind — the one number worth alerting on.
no setter
volume ↔ double
Output gain, 0..1. A GainNode rather than scaling samples, so volume costs the producer nothing and changes take effect without touching the ring.
getter/setter pair

Methods

close() → Future<void>
Stops the worklet and releases the audio context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resume() → Future<void>
Resumes a context the autoplay policy or suspend stopped. Safe to call at any time; call it from a user gesture if isRunning is false.
suspend() → Future<void>
Suspends the audio thread: it stops calling the worklet, so it stops consuming.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

open({required int sampleRate, required int channels, Duration depth = kDefaultRingDepth, String workletUrl = kWorkletAssetUrl}) → Future<AudioRingSink?>
Opens a sink for sampleRate/channels, or returns null when this page cannot host one.