buffer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shape

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

Shape は、1周期分の波形です。

func MakeShape

func MakeShape(data []float64) Shape

MakeShape は、新しい Shape を作成します。

func MakeShapeTrimmed

func MakeShapeTrimmed(data []float64, begin, end int) Shape

MakeShapeTrimmed は、範囲を指定して新しい Shape を作成します。

func (*Shape) Data

func (sh *Shape) Data() []float64

Data は、波形データを返します。

type ShapeHistory

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

ShapeHistory は、波形の履歴を一定数保持する領域です。

func (*ShapeHistory) Freq

func (buf *ShapeHistory) Freq() float64

Freq は、現在バッファの中心にある波形のオリジナルの周波数を返します。

func (*ShapeHistory) Get

func (buf *ShapeHistory) Get(srcPhase, dstPhase float64) float64

Get は、現在バッファの中心にある波形の位相 0≦srcPhase<1 における振幅を返します。 返される振幅は、前後各 sigmaWidth 個の波形の同じ位相における振幅を用いて補間された値で、 0≦dstPhase<1 はその係数に用いられます(小さいほど前方、大きいほど後方の波形に比重が置かれます)。

func (*ShapeHistory) Rotate

func (buf *ShapeHistory) Rotate(s Shape)

Rotate は、波形の履歴に一つの Shape を追記し、一定数を超えた古い Shape を履歴から削除します。 TODO: リングバッファ化

type WaveSource

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

WaveSource は、ソース波形の供給用バッファです。

func NewWaveSource

func NewWaveSource() *WaveSource

NewWaveSource は、新しい WaveSource を作成します。

func (*WaveSource) Append

func (s *WaveSource) Append(data []float64)

Append は、ソース波形をバッファに蓄積します。

func (*WaveSource) Close

func (s *WaveSource) Close()

Close は、ソース波形の供給を終了します。

func (*WaveSource) DiscardUntil

func (s *WaveSource) DiscardUntil(i int)

DiscardUntil は、指定した位置以前のバッファを破棄します。

func (*WaveSource) Read

func (s *WaveSource) Read(begin, end int) ([]float64, bool)

Read は、指定した範囲のソース波形を取得します。 供給が追いついていない場合はブロックします。 供給ソースがクローズした場合は、第2の返り値が false となります。 このとき、第1の返り値は長さ (end-begin) に満たない場合があります。

Jump to

Keyboard shortcuts

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