FakeMonowavePlatform class

An in-memory MonowavePlatform.

Records what it was asked to do and answers from canned values, so a test asserts on the request rather than on bytes it would have to decode.

Implemented types

Constructors

FakeMonowavePlatform({int abi = 1})

Properties

abi int
What abiVersion reports.
getter/setter pair
decoded Map<Object, WaveformPeaks>
Peaks handed back by the decode methods, keyed by path or by byte length. Unregistered inputs get defaultPeaks.
final
decodeRequests List<Object>
Every path passed to decodeFile, and every byte length passed to decodeBytes, in order.
final
defaultPeaks WaveformPeaks Function()
What an unregistered decode returns: two seconds of silence at 44.1 kHz.
getter/setter pair
exports List<(String, String, WaveformDocument)>
Every export requested, as (sourcePath, outputPath, document).
final
hashCode int
The hash code for this object.
no setterinherited
initializeCount int
How many times ensureInitialized was awaited. A host that loads on every build rather than once will show up here.
getter/setter pair
nextCaptureError Object?
When set, openCapture throws this instead of opening.
getter/setter pair
nextDecodeError Object?
When set, the next decode of either kind throws this instead.
getter/setter pair
nextExportError Object?
When set, the next export throws this instead.
getter/setter pair
nextResult MinMax?
When set, reduceMinMax returns this instead of reducing.
getter/setter pair
reductions List<Int16List>
Every window passed to reduceMinMax, in order.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessions List<FakeCaptureSession>
Sessions handed back by openCapture, newest last.
final

Methods

abiVersion() int
The C core's ABI version. Bumped whenever a signature in src/ changes.
override
decodeBytes(Uint8List bytes, {int baseSamplesPerPixel = 128}) Future<WaveformPeaks>
Decodes an in-memory container. The only decode path on web.
override
decodeFile(String path, {int baseSamplesPerPixel = 128}) Future<WaveformPeaks>
Decodes the audio file at path into a peak pyramid.
override
ensureInitialized() Future<void>
Loads the native core, if it is not loaded already. Idempotent.
override
exportWav({required String sourcePath, required String outputPath, required WaveformDocument document}) Future<void>
Writes document to outputPath as 16-bit PCM WAV, reading from sourcePath.
override
install() → void
Installs this as the platform. Call uninstall in tearDown.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openCapture([CaptureConfig config = const CaptureConfig()]) Future<CaptureSession>
Opens a microphone capture session.
override
reduceMinMax(Int16List samples) MinMax
Reduces samples to the pair of extremes it spans.
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

uninstall() → void