decode method
Decode one packet; returns interleaved float PCM.
Implementation
Float32List decode(Uint8List packet) {
_checkNotDisposed();
final inPtr = calloc<Uint8>(packet.length);
inPtr.asTypedList(packet.length).setAll(0, packet);
final outPtr = calloc<Float>(2 * 5760);
final n = _decode(_handle, inPtr, packet.length, outPtr, 5760);
Float32List out;
if (n <= 0) {
out = Float32List(0);
} else {
out = Float32List.fromList(outPtr.asTypedList(n * channels));
}
calloc.free(inPtr);
calloc.free(outPtr);
if (n < 0) {
throw StateError('opus decode failed ($n)');
}
return out;
}