processor

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ScalingSlowWindow in seconds
	ScalingSlowWindow = 5
	// ScalingFastWindow in seconds
	ScalingFastWindow = ScalingSlowWindow * 0.2
	// ScalingDumpPercent is how much we erase on rescale
	ScalingDumpPercent = 0.60
	// ScalingResetDeviation standard deviations from the mean before reset
	ScalingResetDeviation = 1.0
	// PeakThreshold is the threshold to not draw if the peak is less.
	PeakThreshold = 0.01
)

Variables

This section is empty.

Functions

func New

func New(cfg Config) *processor

func NewThreaded

func NewThreaded(cfg Config) *threadedProcessor

Types

type Analyzer

type Analyzer interface {
	BinCount() int
	ProcessBin(int, int, []complex128) float64
	Recalculate(int) int
}

type Config

type Config struct {
	SampleRate   float64          // rate at which samples are read
	SampleSize   int              // number of samples per buffer
	ChannelCount int              // number of channels
	FrameRate    int              // target framerate
	InvertDraw   bool             // invert the direction of bin drawing
	Buffers      [][]input.Sample // sample buffers
	Analyzer     Analyzer         // audio analyzer
	Smoother     Smoother         // time smoother
	Display      Display          // display
}

type Display

type Display interface {
	Bars(...int) int
	Draw([][]float64, int, int, float64, bool) error
}

type Processor

type Processor interface {
	Start(ctx context.Context) context.Context
	Stop()
	Process(context.Context, chan bool, *sync.Mutex)
}

type Smoother added in v1.6.2

type Smoother interface {
	SmoothBin(int, int, float64) float64
}

Jump to

Keyboard shortcuts

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