Class OpusPacket
- Namespace
- DSharpPlus.VoiceLink.Opus
- Assembly
- DSharpPlus.VoiceLink.dll
public static class OpusPacket
- Inheritance
-
OpusPacket
- Inherited Members
Methods
GetBandwidth(ReadOnlySpan<byte>)
Gets the bandwidth of an Opus packet.
public static OpusPacketBandwidth GetBandwidth(ReadOnlySpan<byte> data)
Parameters
data
ReadOnlySpan<byte>Opus packet.
Returns
GetChannelCount(ReadOnlySpan<byte>)
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.
GetFrameCount(ReadOnlySpan<byte>)
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.
GetSampleCount(ReadOnlySpan<byte>, int)
public static int GetSampleCount(ReadOnlySpan<byte> packet, int sampleRate)
Parameters
packet
ReadOnlySpan<byte>sampleRate
intSampling 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.
GetSamplesPerFrame(ReadOnlySpan<byte>, int)
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
intSampling rate in Hz. This must be a multiple of 400, or inaccurate results will be returned.
Returns
- int
Number of samples per frame.