Documentation ¶
Overview ¶
Package pipe provides functionality to build and execute DSP pipelines. Examples could be found in [examples repository](https://github.com/pipelined/example).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Flusher ¶
Flusher is a component that must be flushed in the end of execution. Flush hook is executed in the end of the run. It will be skipped if Reset hook has failed.
type Interrupter ¶
Interrupter is a component that has custom interruption logic. Interrupt hook is executed when Cancel happens.
type Line ¶ added in v0.5.0
Line is a sound processing sequence of components. It has a single pump, zero or many processors executed sequentially and one or many sinks executed in parallel.
type Pipe ¶
type Pipe struct {
// contains filtered or unexported fields
}
Pipe controls the execution of multiple chained lines. Lines might be chained through components, mixer for example. If lines are not chained, they must be controlled by separate Pipes. Use New constructor to instantiate new Pipes.
func (*Pipe) Close ¶
Close must be called to clean up handle's resources. Feedback is closed when line is done.
func (*Pipe) ComponentID ¶
ComponentID finds id of the component within network.
func (*Pipe) Pause ¶
Pause sends a pause event into handle. Calling this method after handle is closed causes a panic. Feedback is closed when Paused state is reached.
func (*Pipe) Push ¶
Push new params into pipe. Calling this method after pipe is closed causes a panic.
type Processor ¶
type Processor interface {
Process(pipeID string, sampleRate signal.SampleRate, numChannels int) (func(signal.Float64) error, error)
}
Processor defines interface for pipe processors. Processor should return output in the same signal buffer as input. It is encouraged to implement in-place processing algorithms. Buffer size could be changed during execution, but only decrease allowed. Number of channels cannot be changed.
func Processors ¶ added in v0.5.0
Processors is a helper function to use in line constructors.
type Pump ¶
type Pump interface {
Pump(pipeID string) (func(signal.Float64) error, signal.SampleRate, int, error)
}
Pump is a source of samples. Pump method returns a new buffer with signal data. If no data is available, io.EOF should be returned. If pump cannot provide data to fulfill buffer, it can trim the size of the buffer to align it with actual data. Buffer size can only be decreased.
type Resetter ¶
Resetter is a component that must be resetted before new run. Reset hook is executed when Run happens.
type Sink ¶
type Sink interface {
Sink(pipeID string, sampleRate signal.SampleRate, numChannels int) (func(signal.Float64) error, error)
}
Sink is an interface for final stage in audio pipeline. This components must not change buffer content. Line can have multiple sinks and this will cause race condition.