Documentation ¶
Overview ¶
Package engine provides a low-level audio interface.
Index ¶
- func Clear(e *Engine) error
- func EmitOutputs(left, right unit.OutRef) func(*Graph) error
- func MountUnit(u *unit.Unit) func(*Graph) error
- func PatchInput(u *unit.Unit, inputs map[string]interface{}, forceReset bool) func(*Graph) error
- func SwapUnit(u1, u2 *unit.Unit) func(*Graph) error
- func UnmountUnit(u *unit.Unit) func(*Graph) error
- type Backend
- type Engine
- type Graph
- func (g *Graph) Close() error
- func (g *Graph) Mount(u *unit.Unit) error
- func (g *Graph) Patch(v interface{}, in *unit.In) error
- func (g *Graph) Processors() []unit.FrameProcessor
- func (g *Graph) Reset(fadeIn, frameSize, sampleRate int) error
- func (g *Graph) Size() int
- func (g *Graph) Sort()
- func (g *Graph) Unmount(u *unit.Unit) error
- func (g *Graph) Unpatch(in *unit.In) error
- type Message
- type MessageChannel
- type Option
- type Reply
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitOutputs ¶
EmitOutputs sinks 1 or 2 outputs to the Engine.
func PatchInput ¶
PatchInput patches values into a Unit's Ins. If `forceReset` is set to `true` all Ins on that Unit that haven't been referenced in `inputs` will be reset to their default values.
Types ¶
type Backend ¶
type Backend interface { Start(func([]float32, [][]float32)) error Stop() error SampleRate() int FrameSize() int }
Backend is a low-level callback-based engine
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the connection of the synthesizer to PortAudio
func (*Engine) Errors ¶
Errors returns a channel that expresses any errors during operation of the Engine
func (*Engine) Reset ¶
Reset clears the state of the Engine. This includes clearing the audio graph.
func (*Engine) SendMessage ¶
SendMessage sends a message to to the engine for it to handle within its goroutine
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is a graph of units.
func (*Graph) Processors ¶
func (g *Graph) Processors() []unit.FrameProcessor
Processors returns the sorted slice of unit.FrameProcessors.
func (*Graph) Sort ¶
func (g *Graph) Sort()
Sort sorts the graph; caching a slice of unit.FrameProcessors.
type Message ¶
type Message struct { Action interface{} Reply chan *Reply }
Message is a payload that contains an operation that the Engine can process and channel that must be received on by the goroutine sending the Message.
func NewMessage ¶
func NewMessage(action interface{}) *Message
NewMessage creates a new Message to be sent to the Engine for evaluation.
type MessageChannel ¶
MessageChannel is abstraction of a channel that handles engine messages. This provides us a means of implementing slightly more strict synchronization behavior during testing.
type Option ¶
type Option func(*Engine)
Option is an option for the Engine
func WithFadeIn ¶
WithFadeIn fades the engine output in to prevent pops
func WithMessageChannel ¶
func WithMessageChannel(ch MessageChannel) Option
WithMessageChannel establishes a MessageChannel to be used for sending and receiving messages within the Engine.
func WithSingleSampleDisabled ¶
func WithSingleSampleDisabled() Option
WithSingleSampleDisabled disables the single-sample feedback loop behavior.