public sealed class VorbisStreamDecoderOgg Vorbis, decoded as it plays.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
What this is for is not saving disk, it is saving memory. A five-minute track as PCM is fifty megabytes resident; as Vorbis it is five on disk and a few kilobytes at a time in flight. That is the difference between music being a thing a game has and a thing it budgets for.
Pure managed, deliberately. A native libvorbis decodes faster and would mean shipping a binary per RID plus a resolver like OpenALLoader's — and the browser target has no answer for that at all. NVorbis publishes under NativeAOT and runs in WebAssembly, and the decode is a fraction of a per-cent of a core for a stereo stream, on the pump's own thread where it is allowed to take as long as it likes.
The container is Ogg and NVorbis owns it. Unlike Opus — where the codec and the container are separate packages and the demuxer is ours — a Vorbis stream only ever comes in an Ogg, and the library that decodes one reads the other.
Fields and properties (4)
public AudioFormat FormatThe rate and channel count it produces.
public long FrameCountHow many frames the whole track is, or -1 if the container does not say.
public long PositionWhich frame the next Decode starts at.
public bool CanSeekWhether Seek works.
Methods (5)
public VorbisStreamDecoder(string path)Opens a track from a file.
public VorbisStreamDecoder(Stream stream, bool leaveOpen = false)Opens a track from a stream.
public int Decode(Span<float> destination, int frameCount)public void Seek(long frame)Moves to a frame.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (1)
- CodecTestsVixen.Audio.Codecs.Tests