FakeCaptureSession class

A CaptureSession that never touches a microphone.

Drives the same state a real session does - recording flag, frame stream, rolling scope, drop counters - so a host's visualizer can be exercised in a widget test. Frames arrive when a test calls emit or emitTone rather than when an audio thread produces them, which makes the timing exact instead of merely likely.

dispose follows the real session in what it leaves readable: produced, dropped, pcmDropped and truncated keep answering afterwards rather than throwing, so a UI that reads a counter while tearing down behaves the same here as it does against a microphone. The real session freezes its counters at dispose to manage it, because the C struct they came from is gone by then.

Implemented types

Constructors

FakeCaptureSession({CaptureConfig config = const CaptureConfig()})

Properties

config CaptureConfig
final
dropped int
Hops the consumer was too slow to collect.
no setteroverride
emitted List<CaptureFrame>
Every frame emitted since construction.
final
frames Stream<CaptureFrame>
Reduced frames, in order. Broadcast, so a visualizer and a meter can both listen.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
isPaused bool
Whether the device is stopped but the take is intact.
no setteroverride
isRecording bool
no setteroverride
nextStartError Object?
When set, start throws this.
getter/setter pair
pcmDropped int
Samples the audio ring dropped because the file writer fell behind.
no setteroverride
produced int
Hops the audio thread produced.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope CaptureScope
A rolling window of recent frames, for drawing.
final
startCount int
getter/setter pair
stopCount int
getter/setter pair
stopResult WaveformPeaks?
What stop returns. Defaults to peaks built from whatever was emitted.
getter/setter pair
truncated bool
Whether history exceeded CaptureConfig.maxDuration, making the peaks from stop partial.
no setteroverride

Methods

dispose() Future<void>
override
dropFrames(int count) → void
Simulates the consumer falling behind.
emit(CaptureFrame frame) → void
Publishes one frame, exactly as a drain would.
emitTone(int count, {double amplitude = 0.5}) → void
Publishes count frames at a steady amplitude from 0 to 1.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() Future<void>
Stops the device without discarding the take.
override
resume() Future<void>
override
start() Future<void>
override
stop() Future<WaveformPeaks>
Stops the device and returns peaks for everything captured.
override
toString() String
A string representation of this object.
inherited

Operators

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