audiomix

package
v0.3.19 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package audiomix sums several sources of interleaved 16-bit PCM into one stream, sample by sample with clipping, padding with silence what a source has not delivered yet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mixer

type Mixer struct {
	// contains filtered or unexported fields
}

Mixer sums sources of interleaved s16le PCM into frames. Each source queues what it delivered; a frame takes the oldest samples of every source, missing ones as silence.

func New

func New(sources, channels, backlog int) *Mixer

New mixes sources of channels interleaved channels, each queueing at most backlog frames ahead of Mix: a source running fast is trimmed from its oldest samples rather than growing without end.

func (*Mixer) Mix

func (m *Mixer) Mix(frame []int16)

Mix fills frame, whole interleaved frames, with the sum of the sources' oldest samples, clipped, and drops them from the queues.

func (*Mixer) Push

func (m *Mixer) Push(source int, chunk []byte)

Push queues source's chunk of little-endian samples.

func (*Mixer) Queued

func (m *Mixer) Queued(source int) int

Queued is the samples source has queued.

Jump to

Keyboard shortcuts

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