Documentation ¶
Index ¶
- Variables
- func CopyBuffers(dst, src [][]Sample)
- func DefaultBackend() string
- func EnsureBufferLen(cfg SessionConfig, buf [][]Sample) bool
- func GetAllBackendNames() []string
- func HasBackend(name string) bool
- func MakeBuffers(channels, samples int) [][]Sample
- func RegisterBackend(name string, b Backend)
- type Backend
- type Device
- type NamedBackend
- type Processor
- type Sample
- type Session
- type SessionConfig
Constants ¶
This section is empty.
Variables ¶
var Backends []NamedBackend
Functions ¶
func CopyBuffers ¶
func CopyBuffers(dst, src [][]Sample)
CopyBuffers deep copies src to dst. It does NOT do length check.
func DefaultBackend ¶ added in v1.8.0
func DefaultBackend() string
Get the default backend depending on runtime.GOOS
func EnsureBufferLen ¶ added in v1.5.0
func EnsureBufferLen(cfg SessionConfig, buf [][]Sample) bool
EnsureBufferLen ensures that the given buffer has matching sizes with the needed parameters from SessionConfig. It is effectively a bound check.
func GetAllBackendNames ¶ added in v1.8.0
func GetAllBackendNames() []string
Get all installed backend names.
func HasBackend ¶ added in v1.8.0
func MakeBuffers ¶
MakeBuffer allocates a slice of sample buffers.
func RegisterBackend ¶
RegisterBackend registers a backend globally. This function is not thread-safe, and most packages should call it on init().
Types ¶
type Backend ¶
type Backend interface { // Init should do nothing if called more than once. Init() error Close() error Devices() ([]Device, error) DefaultDevice() (Device, error) Start(SessionConfig) (Session, error) }
func FindBackend ¶
FindBackend is a helper function that finds a backend. It returns nil if the backend is not found.
func InitBackend ¶ added in v1.5.0
type NamedBackend ¶
type Processor ¶ added in v1.5.0
type Processor interface {
Process()
}
Processor is called by Session everytime the buffer is full. Session may call this on another goroutine; the implementation must handle synchronization. It must also handle buffer swapping or copying if it wants to synchronize it away.
type Session ¶
type Session interface { // Start blocks until either the context is canceled or an error is // encountered. Start(context.Context, [][]Sample, chan bool, *sync.Mutex) error }
Session is the interface for an input session. Its task is to call the processor everytime the buffer is full using the parameters given in SessionConfig.
Directories ¶
Path | Synopsis |
---|---|
Package all imports all backends implemented by the input package.
|
Package all imports all backends implemented by the input package. |
common
|
|
execread
Package execread provides a shared struct that wraps around cmd.
|
Package execread provides a shared struct that wraps around cmd. |
Package portaudio contains modifications of CGO bindings for portaudio
|
Package portaudio contains modifications of CGO bindings for portaudio |