linear

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RescalePTS

func RescalePTS(value media.Pts, fromRate, toRate int) media.Pts

RescalePTS converts a presentation timestamp expressed in fromRate units into the equivalent timestamp in toRate units, rounding to the nearest sample.

Types

type Resampler

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

Resampler implements streaming linear-interpolation resampling from inputRate to targetRate, labeling emitted blocks with outputRate. The distinction between targetRate and outputRate lets callers reuse the same interpolation math for both true sample-rate conversion (resample, where outputRate == targetRate) and playback-retime changes (retime, where outputRate stays pinned to inputRate while targetRate is virtual).

func NewResampler

func NewResampler(inputRate, targetRate, outputRate int, basePTS media.Pts) *Resampler

func (*Resampler) Finish

func (r *Resampler) Finish() (audio.Block, bool)

Finish emits the trailing tail block (holding the last input sample) that rounding leaves undelivered, if any. ok is false when nothing remains to flush.

func (*Resampler) Process

func (r *Resampler) Process(block audio.Block) audio.Block

Jump to

Keyboard shortcuts

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