SimpleOpusDecoder class

An easy to use implementation of OpusDecoder. Don't forget to call destroy once you are done with it.

All method calls in this calls allocate their own memory everytime they are called. See the BufferedOpusDecoder for an implementation with less allocation calls.

Inheritance

Constructors

SimpleOpusDecoder({required int sampleRate, required int channels})
Creates an new SimpleOpusDecoder based on the sampleRate and channels. See the matching fields for more information about these parameters.
factory

Properties

channels int
Number of channels, must be 1 for mono or 2 for stereo.
final
destroyed bool
Wheter this decoder was already destroyed by calling destroy. If so, calling any method will result in an OpusDestroyedError.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
lastPacketDurationMs int?
The duration of the last decoded packet in ms or null if there was no packet yet.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampleRate int
The sample rate in Hz for this decoder. Opus supports sample rates from 8kHz to 48kHz so this value must be between 8000 and 48000.
final

Methods

decode({Uint8List? input, bool fec = false, int? loss}) Int16List
Decodes an opus packet to s16le samples, represented as Int16List. Use null as input to indicate packet loss.
override
decodeFloat({Uint8List? input, bool fec = false, bool autoSoftClip = false, int? loss}) Float32List
Decodes an opus packet to float samples, represented as Float32List. Use null as input to indicate packet loss.
override
destroy() → void
Destroys this decoder by releasing all native resources. After this, it is no longer possible to decode using this decoder, so any further method call will throw an OpusDestroyedError.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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