mixer

package
v0.0.0-...-67dd4ed Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInputBufferFrames = 5
	DefaultInputBufferMin    = DefaultInputBufferFrames/2 + 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

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

func (*Input) Close

func (i *Input) Close() error

func (*Input) SampleRate

func (i *Input) SampleRate() int

func (*Input) String

func (i *Input) String() string

func (*Input) WriteSample

func (i *Input) WriteSample(sample msdk.PCM16Sample) error

type Mixer

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

func NewMixer

func NewMixer(out msdk.Writer[msdk.PCM16Sample], bufferDur time.Duration, channels int, options ...MixerOptions) (*Mixer, error)

func (*Mixer) NewInput

func (m *Mixer) NewInput() *Input

func (*Mixer) RemoveInput

func (m *Mixer) RemoveInput(inp *Input)

func (*Mixer) SampleRate

func (m *Mixer) SampleRate() int

func (*Mixer) Stop

func (m *Mixer) Stop()

func (*Mixer) String

func (m *Mixer) String() string

type MixerOptions

type MixerOptions func(*Mixer)

func WithInputBufferFrames

func WithInputBufferFrames(frames int) MixerOptions

func WithOutputChannel

func WithOutputChannel() MixerOptions

func WithOutputChannelSize

func WithOutputChannelSize(size int) MixerOptions

Makes mixer write to a channel in place of directly calling out.WriteSample(), which unblocks the mixer ticker.

func WithStats

func WithStats(stats *Stats) MixerOptions

type Stats

type Stats struct {
	Tracks       atomic.Int64
	TracksTotal  atomic.Uint64
	Restarts     atomic.Uint64
	TimingResets atomic.Uint64

	Mixes         atomic.Uint64
	TimedMixes    atomic.Uint64
	JumpMixes     atomic.Uint64
	ZeroMixes     atomic.Uint64
	NegativeMixes atomic.Uint64

	InputSamples        atomic.Uint64
	InputFrames         atomic.Uint64
	InputSamplesDropped atomic.Uint64
	InputFramesDropped  atomic.Uint64

	MixedSamples atomic.Uint64
	MixedFrames  atomic.Uint64

	OutputSamples atomic.Uint64
	OutputFrames  atomic.Uint64

	WriteErrors  atomic.Uint64
	BlockedMixes atomic.Uint64
}

Jump to

Keyboard shortcuts

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