Table of Contents

Interface IMp3FrameDecompressor

Namespace
NAudio.Wave
Assembly
NAudio.Core.dll

Interface for MP3 frame by frame decoder

public interface IMp3FrameDecompressor : IDisposable
Inherited Members

Properties

OutputFormat

PCM format that we are converting into

WaveFormat OutputFormat { get; }

Property Value

WaveFormat

Methods

DecompressFrame(Mp3Frame, byte[], int)

Decompress a single MP3 frame into the supplied byte buffer.

int DecompressFrame(Mp3Frame frame, byte[] dest, int destOffset)

Parameters

frame Mp3Frame

Frame to decompress

dest byte[]

Output buffer — must be large enough to hold one frame's PCM output from destOffset onwards

destOffset int

Offset within output buffer

Returns

int

Bytes written to output buffer

Remarks

Prefer the DecompressFrame(Mp3Frame, Span<byte>) overload where possible. This overload is retained for backward compatibility with existing implementations (including external decoders such as NLayer).

DecompressFrame(Mp3Frame, Span<byte>)

Decompress a single MP3 frame into the supplied span.

int DecompressFrame(Mp3Frame frame, Span<byte> dest)

Parameters

frame Mp3Frame

Frame to decompress

dest Span<byte>

Output span — must be large enough to hold one frame's PCM output

Returns

int

Bytes written to dest

Remarks

The default implementation routes through DecompressFrame(Mp3Frame, byte[], int) via an ArrayPool<T>-backed byte buffer, so existing implementations written against the byte[] overload continue to work unchanged. Implementations that can write directly into a span should override this method to avoid the intermediate copy.

Reset()

Tell the decoder that we have repositioned

void Reset()