AudioHub class final

Owns one source session and its independent bounded fan-out router.

Applications normally create one hub for microphone audio and another for system audio. Tracks are never merged implicitly; use audio_processing's explicit synchronizer/mixer when a chronological or mixed stream is needed.

Properties

hashCode int
The hash code for this object.
no setterinherited
router AudioRouter
Dynamic bounded route graph owned by this hub.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source → AudioSourceSession
Prepared source owned by this hub.
final
state → AudioSessionState
Current hub lifecycle.
no setter

Methods

abort({AudioFailure? failure}) Future<void>
Immediately aborts the source and every route.
attach({required String id, required AudioSink sink, required AudioRouteOptions options, AudioCancellationToken? cancellationToken}) Future<AudioRoute>
Prepares and attaches sink, transferring session ownership to the route.
attachPrepared({required String id, required AudioSinkSession sink, required AudioRouteOptions options}) AudioRoute
Attaches an already prepared session and transfers its ownership.
close() Future<void>
Deterministically finalizes and releases every owned resource.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start({AudioCancellationToken? cancellationToken}) Future<void>
Subscribes to source frames before starting native or synthesized audio.
stop({AudioCancellationToken? cancellationToken}) Future<void>
Gracefully stops capture/synthesis, drains routes, and finalizes sinks.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

prepare(AudioSource audioSource, {AudioCancellationToken? cancellationToken}) Future<AudioHub>
Prepares source without starting it, allowing routes and listeners to attach before the first frame or health event.