Vixen
02b45cc4
csharp
public sealed class AdpcmStreamDecoder

ADPCM behind the same seam as Vorbis and Opus, so nothing above it has to care.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

It needs no third-party package, which is most of the point. The codec is a table and twenty lines, so this lives in Vixen.Audio rather than in Vixen.Audio.Codecs — a game that wants four-to-one on its effects should not have to take a dependency to get it, and every platform can decode it including the browser.

Seeking is exact and cheap, unlike the other two. Vorbis has to bisect on page granules and Opus decodes forward from the start; a block here begins with the sample and step it starts from, so a seek is a division. That is what makes this the format for sounds that start at unpredictable moments, which is what a game's effects are.

Fields and properties (4)

  • public AudioFormat Format

    The rate and channel count it produces.

  • public long FrameCount

    How many frames the whole track is, or -1 if the container does not say.

  • public long Position

    Which frame the next Decode starts at.

  • public bool CanSeek

    Whether Seek works.

Methods (4)

  • public AdpcmStreamDecoder(byte[] data, in AudioFormat format, int samplesPerBlock, long frameCount = -1)

    A decoder over compressed blocks already in memory.

  • public int Decode(Span<float> destination, int frameCount)

    Decodes the next frames.

  • public void Seek(long frame)
  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (1)

  • AdpcmTestsVixen.Audio.Tests