pbReader

package
Version: v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option is the type for a function option

func Channels

func Channels(chs int) Option

Channels is a functional option to set the amount of channels to be used with the audio device. Typically this is either Mono (1) or Stereo (2). Make sure that your audio device supports the specified amount of channels.

func Decoder

func Decoder(dec audiocodec.Decoder) Option

Decoder is a functional option to set a specific decoder. By default, the opus decoder is used.

func Samplerate

func Samplerate(s float64) Option

Samplerate is a functional option to set the sampling rate of the audio device. Make sure your audio device supports the specified sampling rate.

type Options

type Options struct {
	DeviceName string
	Decoder    audiocodec.Decoder
	Channels   int
	Samplerate float64
	Callback   audio.OnDataCb
}

Options is the data structure which holds the option values. These values are typically set through functional options.

type PbReader

type PbReader struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

PbReader implements the audio.Source interface and is used to read audio frames encapsulated in Protocol Buffer messages, typically received from the network.

func NewPbReader

func NewPbReader(opts ...Option) (*PbReader, error)

NewPbReader is the constructor for a PbReader object.

func (*PbReader) Close

func (pbr *PbReader) Close() error

Close shuts down the PbReader

func (*PbReader) Enqueue

func (pbr *PbReader) Enqueue(data []byte) error

Enqueue is the entry point for the PbReader. Incoming Protobufs are enqueded with this function.

func (*PbReader) SetCb

func (pbr *PbReader) SetCb(cb audio.OnDataCb)

SetCb sets the callback which get's executed once the Protobuf has been converted in an audio.Msg.

func (*PbReader) Start

func (pbr *PbReader) Start() error

Start processing Protobufs

func (*PbReader) Stop

func (pbr *PbReader) Stop() error

Stop processing Protobufs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL