Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidState = errors.New("invalid state")
ErrInvalidState is returned if pipe method cannot be executed at this moment.
Functions ¶
Types ¶
type Interrupter ¶
Interrupter defines component that has custom interruption logic.
type Logger ¶
type Logger interface {
Debug(...interface{})
Info(...interface{})
}
Logger is a global interface for pipe loggers
type Option ¶
Option provides a way to set functional parameters to pipe.
func WithLogger ¶
WithLogger sets logger to Pipe. If this option is not provided, silent logger is used.
func WithMetric ¶
WithMetric adds meterics for this pipe and all components.
func WithProcessors ¶
WithProcessors sets processors to Pipe
type Pipe ¶
type Pipe struct {
// contains filtered or unexported fields
}
Pipe is a pipeline with fully defined sound processing sequence it has:
1 pump 0..n processors 1..n sinks
func (*Pipe) ComponentID ¶
ComponentID returns component id.
func (*Pipe) Pause ¶
Pause sends a pause event into pipe. Calling this method after pipe is closed causes a panic.
func (*Pipe) Push ¶
func (p *Pipe) Push(component interface{}, paramFuncs ...func())
Push new params into pipe. Calling this method after pipe is closed causes a panic.
func (*Pipe) Resume ¶
Resume sends a resume event into pipe. Calling this method after pipe is closed causes a panic.
type Processor ¶
type Processor interface {
Process(pipeID string, sampleRate, numChannels, bufferSize int) (func([][]float64) ([][]float64, error), error)
}
Processor defines interface for pipe-processors
type Pump ¶
type Pump interface {
Pump(pipeID string, bufferSize int) (func() ([][]float64, error), int, int, error)
}
Pump is a source of samples. Pump method returns a new buffer with signal data. Implentetions should use next error conventions:
- nil if a full buffer was read;
- io.EOF if no data was read;
- io.ErrUnexpectedEOF if not a full buffer was read.
The latest case means that pump executed as expected, but not enough data was available. This incomplete buffer still will be sent further and pump will be finished gracefully.

