public sealed class OpusStreamDecoderOpus in an Ogg, decoded as it plays.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Opus is the better codec and the more awkward one. It beats Vorbis at every bitrate and is the only sensible choice for voice, but the codec and the container come from different places — Concentus takes a packet and knows nothing about Ogg, so OggReader is ours.
Always 48 kHz, whatever the file says. Opus decodes at 8, 12, 16, 24 or 48, and 48 is the only rate at which nothing is resampled on the way out — the OpusHead's "input sample rate" is a note about what was fed to the encoder and has no bearing on what comes out.
The pre-skip is not optional. Every Opus stream begins with priming samples the encoder needed and the listener must not hear; a decoder that ignores it starts every track with a few milliseconds of an artefact. The count is in the header and those samples are discarded here.
Fields and properties (5)
public const int DecodeRateThe rate Opus is decoded at, whatever the file was encoded from.
public AudioFormat FormatThe rate and channel count it produces.
public long FrameCountpublic long PositionWhich frame the next Decode starts at.
public bool CanSeekWhether Seek works.
Methods (5)
public OpusStreamDecoder(string path)Opens a track from a file.
public OpusStreamDecoder(Stream stream, bool leaveOpen = false)Opens a track from a stream.
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)
- CodecTestsVixen.Audio.Codecs.Tests