mux

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mux

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

Mux is a multiplexer for multiple io.Reader objects.

func New

func New(channelNum, bitDepthInBytes int) *Mux

New creates a new Mux with the specified number of channels and bit depth.

func (*Mux) AddSource

func (m *Mux) AddSource(source io.Reader)

AddSource adds a reader to the Mux.

func (*Mux) Close

func (m *Mux) Close() error

Close invalidates the Mux. It doesn't close its readers.

func (*Mux) Read

func (m *Mux) Read(buf []byte) (int, error)

Read reads data from all of its readers, interprets it as samples with the bit depth specified during its creation, then adds all of the samples together and fills the buf slice with the result of this.

If there are no readers, Read fills in some zeros to prevent a program from freezing.

func (*Mux) RemoveSource

func (m *Mux) RemoveSource(source io.Reader)

RemoveSource removes a reader from the Mux.

func (*Mux) Sources added in v0.6.2

func (m *Mux) Sources() []io.Reader

Sources returns all the registered readers.

Jump to

Keyboard shortcuts

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