audio

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodecCELTAlpha = 0
	CodecSpeex     = 2 // Deprecated
	CodecCELTBeta  = 3
	CodecOpus      = 4 // Preferred
)

Codec IDs for Mumble audio. See docs/protocol/voice-data.md.

View Source
const MaxVarintLen = 10

MaxVarintLen is the maximum number of bytes required to encode a Mumble varint.

Variables

View Source
var ErrPacketTooShort = errors.New("audio: packet too short")

ErrPacketTooShort is returned when the packet buffer is too short to parse.

Functions

func DecodeVarint

func DecodeVarint(b []byte) (int64, int)

Decode reads the first varint-encoded number from the given buffer. Returns the value and the number of bytes read. Returns 0 bytes read on error.

func EncodeVarint

func EncodeVarint(b []byte, value int64) int

EncodeVarint encodes the given value in Mumble varint format. Returns the number of bytes written. Caller must ensure b has sufficient space (MaxVarintLen for safety).

Types

type ParsedPacket

type ParsedPacket struct {
	Codec        uint8  // Audio codec ID (bits 7-5 of header)
	Target       uint8  // Voice target (bits 4-0 of header)
	Sequence     int64  // Sequence number
	PayloadLen   int64  // Payload length in bytes (bit 13 masked out)
	IsTerminator bool   // True if bit 13 of payload length varint was set
	Payload      []byte // Audio frame data
}

ParsedPacket is the result of parsing a client-to-server legacy binary audio packet.

func ParsePacket

func ParsePacket(data []byte) (*ParsedPacket, error)

ParsePacket parses a client-to-server legacy binary UDP audio packet. The server receives these from clients; no session field is present. See docs/protocol/voice-data.md.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL