snd

package
Version: v0.0.0-...-d40d5fc Latest Latest
Warning

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

Go to latest
Published: May 27, 2019 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyNoteState = &NoteState{
	Timecode:        0,
	ReleaseTimecode: 0,
	Volume:          0,
	On:              true,
	Phase:           0,
}

Functions

This section is empty.

Types

type BasicConnector

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

func (*BasicConnector) Read

func (c *BasicConnector) Read(samples *Samples)

func (*BasicConnector) ReadBuffered

func (c *BasicConnector) ReadBuffered(samplerate uint32, length int, freq float32, state *NoteState) *Samples

func (*BasicConnector) ReadStateless

func (c *BasicConnector) ReadStateless(samples *Samples, freq float32, state *NoteState)

func (*BasicConnector) SetReadable

func (c *BasicConnector) SetReadable(r Readable)

type BasicReadable

type BasicReadable struct{}

type BasicWritableProvider

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

func (*BasicWritableProvider) AddInput

func (p *BasicWritableProvider) AddInput(name string, defaultValue float32) *BasicConnector

func (*BasicWritableProvider) GetInput

func (p *BasicWritableProvider) GetInput(name string) (Writable, bool)

func (*BasicWritableProvider) InitBasicWritableProvider

func (p *BasicWritableProvider) InitBasicWritableProvider()

type DatWriter

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

func NewDatWriter

func NewDatWriter(samplerate uint32, filepath string) (*DatWriter, error)

func (*DatWriter) Close

func (dat *DatWriter) Close()

func (*DatWriter) SetReadable

func (dat *DatWriter) SetReadable(r Readable)

func (*DatWriter) Start

func (dat *DatWriter) Start() error

func (*DatWriter) Stop

func (dat *DatWriter) Stop() error

type IOutput

type IOutput interface {
	Writable
	Start() error
	Stop() error
	Close()
}

type NoteState

type NoteState struct {
	Timecode        uint32
	ReleaseTimecode uint32
	Volume          float32
	On              bool
	Phase           uint32
}

type Output

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

Output object for sound output

func NewOutput

func NewOutput(samplerate uint32, buffersize uint32) (*Output, error)

NewOutput creates a new Output instance

func (*Output) Close

func (o *Output) Close()

Close closes the output

func (*Output) SetReadable

func (o *Output) SetReadable(r Readable)

func (*Output) Start

func (o *Output) Start() (err error)

Start starts playback on the output

func (*Output) Stop

func (o *Output) Stop() (err error)

Stop stops playback

func (*Output) Write

func (o *Output) Write(samples *Samples) error

Write writes all given samples to the ouput buffer

type Readable

type Readable interface {
	Read(samples *Samples)
	ReadStateless(samples *Samples, freq float32, state *NoteState)
}

type Sample

type Sample struct {
	L float32
	R float32
}

Sample contains one sound sample as 32bit floats (range -1.0 to 1.0)

type Samples

type Samples struct {
	Frames     []Sample
	SampleRate uint32
}

Samples is a list of samples and their sample rate

func NewSamples

func NewSamples(samplerate uint32, length int) *Samples

func (*Samples) Add

func (s *Samples) Add(samples ...Sample)

Add adds one or more Samples to a Samples struct

type Writable

type Writable interface {
	SetReadable(r Readable)
}

type WritableProvider

type WritableProvider interface {
	GetInput(name string) (Writable, bool)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL