Table of Contents

Class OpusPacket

Namespace
DSharpPlus.VoiceLink.Opus
Assembly
DSharpPlus.VoiceLink.dll
public static class OpusPacket
Inheritance
OpusPacket
Inherited Members

Methods

Gets the bandwidth of an Opus packet.

public static OpusPacketBandwidth GetBandwidth(ReadOnlySpan<byte> data)

Parameters

data ReadOnlySpan<byte>

Opus packet.

Returns

OpusPacketBandwidth

Gets the number of channels from an Opus packet.

public static int GetChannelCount(ReadOnlySpan<byte> data)

Parameters

data ReadOnlySpan<byte>

Opus packet.

Returns

int

The number of channels in the packet.

Exceptions

OpusException

The Opus library has thrown an exception.

Gets the number of frames in an Opus packet.

public static int GetFrameCount(ReadOnlySpan<byte> data)

Parameters

data ReadOnlySpan<byte>

Opus packet.

Returns

int

The number of frames in the packet.

Exceptions

OpusException

The Opus library has thrown an exception.

public static int GetSampleCount(ReadOnlySpan<byte> packet, int sampleRate)

Parameters

packet ReadOnlySpan<byte>
sampleRate int

Sampling rate in Hz. This must be a multiple of 400, or inaccurate results will be returned.

Returns

int

The number of samples in the packet.

Exceptions

OpusException

The Opus library has thrown an exception.

Gets the number of samples per frame from an Opus packet.

public static int GetSamplesPerFrame(ReadOnlySpan<byte> data, int sampleRate)

Parameters

data ReadOnlySpan<byte>

Opus packet. This must contain at least one byte of data.

sampleRate int

Sampling rate in Hz. This must be a multiple of 400, or inaccurate results will be returned.

Returns

int

Number of samples per frame.