module

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: May 13, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package module provides built-in modules

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, fn func(Config) (Patcher, error))

Register registers a module under a specified name. This is then exposed as a constructor in the `eolian.synth` package at the Lua layer.

func RegisteredTypes

func RegisteredTypes() []string

RegisteredTypes returns a list of all registered module types

Types

type Config

type Config map[string]interface{}

Config is the conduit for providing initialization information to a module

type IO

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

IO is the input/output registry of a module. It manages the lifecycles of the ports; fascilitating connects and disconnects between them. This struct lazy initializes so it is useful by default. It is intended to just be embedded inside other structs that represent a module.

func (*IO) AddInput added in v0.0.12

func (io *IO) AddInput(in *In) error

AddInput registers a new input with the module. This is primarily used to allow for lazy-creation of inputs when patched instead of at the module's create-time.

func (*IO) AddOutput added in v0.0.12

func (io *IO) AddOutput(out *Out) error

AddOutput registers a new output with the module. Like AddInput, it is used for lazy-creation of outputs.

func (*IO) Close added in v0.0.10

func (io *IO) Close() error

Close makes IO a noop io.Closer

func (*IO) Expose

func (io *IO) Expose(typ string, ins []*In, outs []*Out) error

Expose registers inputs and outputs of the module so that they can be used in patching

func (*IO) ID added in v0.0.3

func (io *IO) ID() string

ID returns the module's unique identifier

func (*IO) Inputs

func (io *IO) Inputs() map[string]*In

Inputs lists all registered inputs

func (*IO) Output

func (io *IO) Output(name string) (*Out, error)

Output realizes a registered output and returns it for patching

func (*IO) Outputs

func (io *IO) Outputs() map[string]*Out

Outputs lists all registered outputs

func (*IO) OutputsActive

func (io *IO) OutputsActive(sinking bool) int

OutputsActive returns the total count of actively patched outputs

func (*IO) Patch

func (io *IO) Patch(name string, t interface{}) error

Patch assigns an input's processor to some source (Processor, Value, etc)

func (*IO) Reset

func (io *IO) Reset() error

Reset disconnects all inputs from their sources (closing them in the process) and re-assigns the input to its original default value

func (*IO) ResetOnly added in v0.0.10

func (io *IO) ResetOnly(names []string) error

ResetOnly disconnects specific inputs from their sources

func (*IO) String added in v0.0.3

func (io *IO) String() string

func (*IO) Type added in v0.0.17

func (io *IO) Type() string

Type returns the module's type

type Identifier added in v0.0.3

type Identifier interface {
	ID() string
	Type() string
}

Identifier returns the identity and type of a module

type In

type In struct {
	Source       dsp.Processor
	Name         string
	ForceSinking bool
	// contains filtered or unexported fields
}

In is a module input

func NewIn added in v0.0.18

func NewIn(name string, v dsp.Processor) *In

NewIn returns a new unbuffered input

func NewInBuffer added in v0.0.18

func NewInBuffer(name string, v dsp.Processor) *In

NewInBuffer returns a new buffered input

func (*In) Close

func (i *In) Close() error

Close closes the input

func (*In) IsSinking added in v0.0.11

func (i *In) IsSinking() bool

IsSinking returns whether the input is sinking to audio output

func (*In) LastFrame

func (i *In) LastFrame() dsp.Frame

LastFrame returns the last frame read with ProcessFrame

func (*In) Process added in v0.0.18

func (i *In) Process(f dsp.Frame)

Process reads the output of the source into a Frame

func (*In) ProcessFrame added in v0.0.18

func (i *In) ProcessFrame() dsp.Frame

ProcessFrame reads an entire frame into the buffered input

func (*In) SourceName added in v0.0.8

func (i *In) SourceName() string

SourceName returns the name of the connected output

func (*In) String

func (i *In) String() string

type InitFunc

type InitFunc func(Config) (Patcher, error)

InitFunc is a factory function that returns a module

func Lookup

func Lookup(name string) (InitFunc, error)

Lookup retrieves a module's initialization function from the Registry

type LuaMethod added in v0.0.15

type LuaMethod struct {
	Lock bool
	Func interface{}
}

LuaMethod is a function exposed to the Lua layer. If Lock is true, the synthesizer module graph will be locked when it is called to prevent race conditions.

type Out

type Out struct {
	Name     string
	Provider dsp.ProcessorProvider
	// contains filtered or unexported fields
}

Out is a module output

func (*Out) Close

func (o *Out) Close() error

Close closes the output

func (*Out) DestinationNames added in v0.0.19

func (o *Out) DestinationNames() []string

DestinationNames returns the name of the destination input

func (*Out) IsActive

func (o *Out) IsActive() bool

IsActive returns whether or not there is a realized Processor assigned

func (*Out) IsSinking added in v0.0.11

func (o *Out) IsSinking() bool

IsSinking returns whether the output is sinking to audio output

func (*Out) Process added in v0.0.18

func (o *Out) Process(out dsp.Frame)

Process proxies to the internal processor if its set

func (*Out) String added in v0.0.3

func (o *Out) String() string

type Patcher

type Patcher interface {
	Identifier
	PortLister
	Resetter
	io.Closer

	Patch(string, interface{}) error
	Output(string) (*Out, error)
}

Patcher is the patching behavior of a module

type Port

type Port struct {
	Patcher
	Port string
}

Port represents the address of a specific port on a Patcher

type PortLister added in v0.0.20

type PortLister interface {
	Inputs() map[string]*In
	Outputs() map[string]*Out
}

PortLister lists inputs and outputs of a module

type Resetter added in v0.0.20

type Resetter interface {
	Reset() error
	ResetOnly([]string) error
}

Resetter resets inputs back to their normal values

Directories

Path Synopsis
Package midi provides MIDI input handling
Package midi provides MIDI input handling
Package osc provides Open Sound Control (OSC) input handling
Package osc provides Open Sound Control (OSC) input handling

Jump to

Keyboard shortcuts

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