FakeMonowavePlatform class
An in-memory MonowavePlatform.
This fake records each request and answers with canned values. As a result, a test asserts on the request and not on bytes that the test must decode.
- Implemented types
Constructors
- FakeMonowavePlatform({int abi = 1})
Properties
- abi ↔ int
-
What abiVersion reports.
getter/setter pair
-
bytePlaybacks
→ List<
(int, WaveformDocument)> -
Every byte-playback requested, as (byteLength, document).
final
-
byteRenders
→ List<
(int, WaveformDocument)> -
Every byte-render requested, as (byteLength, document).
final
-
decoded
→ Map<
Object, WaveformPeaks> -
The peaks that the decode methods return, keyed by path or by byte length.
An input that is not in this map gets defaultPeaks.
final
-
decodeRequests
→ List<
Object> -
Every path passed to decodeFile, and every byte length passed to
decodeBytes, in order.
final
- defaultPeaks ↔ WaveformPeaks Function()
-
If the input is not in decoded, the decode returns this value. The
default is 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 a caller awaited ensureInitialized. This count shows a
host that loads the C core on every build instead of one time only.
getter/setter pair
- nextCaptureError ↔ Object?
-
If a test sets this field, openCapture throws it and opens no session.
getter/setter pair
- nextDecodeError ↔ Object?
-
If a test sets this field, the next decode of either kind throws it.
getter/setter pair
- nextExportError ↔ Object?
-
If a test sets this field, the next export throws it.
getter/setter pair
- nextPlaybackError ↔ Object?
-
If a test sets this field, openPlayback throws it and opens no session.
getter/setter pair
- nextRender ↔ Int16List?
-
What renderPcm returns. The default is silence with one frame for each
source frame that the document describes. As a result, a host can assert
on the length with no need to synthesize audio.
getter/setter pair
- nextRenderError ↔ Object?
-
If a test sets this field, the next render throws it.
getter/setter pair
- nextResult ↔ MinMax?
-
If a test sets this field, reduceMinMax returns it and does not reduce
the samples.
getter/setter pair
-
playbacks
→ List<
FakePlaybackSession> -
The sessions that openPlayback returns, newest last.
final
-
reductions
→ List<
Int16List> -
Every window passed to reduceMinMax, in order.
final
-
renders
→ List<
(String, WaveformDocument)> -
Every render requested, as (sourcePath, document).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sessions
→ List<
FakeCaptureSession> -
The sessions that openCapture returns, newest last.
final
Methods
-
abiVersion(
) → int -
The ABI version of the C core. Each time a signature in
src/changes, this version increases.override -
decodeBytes(
Uint8List bytes, {int baseSamplesPerPixel = 128}) → Future< WaveformPeaks> -
This method decodes a container that is already in memory. On web, this
method is the only decode path.
override
-
decodeFile(
String path, {int baseSamplesPerPixel = 128}) → Future< WaveformPeaks> -
This method decodes the audio file at
pathinto a peak pyramid.override -
ensureInitialized(
) → Future< void> -
If the C core is not loaded already, this method loads it. A second
call does nothing.
override
-
exportWav(
{required String sourcePath, required String outputPath, required WaveformDocument document}) → Future< void> -
This method reads from
sourcePathand writesdocumenttooutputPathas 16-bit PCM WAV.override -
install(
) → void -
Installs this fake 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> -
This method opens a microphone capture session.
override
-
openPlayback(
{required String sourcePath, required WaveformDocument document}) → Future< PlaybackSession> -
This method reads from
sourcePathand opens a playback session overdocument.override -
openPlaybackBytes(
{required Uint8List bytes, required WaveformDocument document}) → Future< PlaybackSession> -
This method opens a playback session over bytes that are already in
memory.
override
-
reduceMinMax(
Int16List samples) → MinMax -
This method reduces
samplesto the pair of extremes that the samples span.override -
renderPcm(
{required String sourcePath, required WaveformDocument document}) → Future< Int16List> -
This method renders
documentto 16-bit PCM and writes no file.override -
renderPcmBytes(
{required Uint8List bytes, required WaveformDocument document}) → Future< Int16List> -
This method renders
documentto 16-bit PCM from bytes that are already in memory.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
uninstall(
) → void