pcm

package
Version: v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SampleDataFormat8BitUnsigned is for unsigned 8-bit data
	SampleDataFormat8BitUnsigned = SampleDataFormat(iota)
	// SampleDataFormat8BitSigned is for signed 8-bit data
	SampleDataFormat8BitSigned
	// SampleDataFormat16BitLEUnsigned is for unsigned, little-endian, 16-bit data
	SampleDataFormat16BitLEUnsigned
	// SampleDataFormat16BitLESigned is for signed, little-endian, 16-bit data
	SampleDataFormat16BitLESigned
	// SampleDataFormat16BitBEUnsigned is for unsigned, big-endian, 16-bit data
	SampleDataFormat16BitBEUnsigned
	// SampleDataFormat16BitBESigned is for signed, big-endian, 16-bit data
	SampleDataFormat16BitBESigned
	// SampleDataFormat32BitLEFloat is for little-endian, 32-bit floating-point data
	SampleDataFormat32BitLEFloat
	// SampleDataFormat32BitBEFloat is for big-endian, 32-bit floating-point data
	SampleDataFormat32BitBEFloat
	// SampleDataFormat64BitLEFloat is for little-endian, 64-bit floating-point data
	SampleDataFormat64BitLEFloat
	// SampleDataFormat64BitBEFloat is for big-endian, 64-bit floating-point data
	SampleDataFormat64BitBEFloat
)

Variables

View Source
var (
	// ErrIndexOutOfRange is for when a slice is iterated with an index that's out of the range
	ErrIndexOutOfRange = errors.New("index out of range")
)

Functions

This section is empty.

Types

type NativeSampleData added in v1.0.4

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

func (*NativeSampleData) Channels added in v1.0.4

func (s *NativeSampleData) Channels() int

Channels returns the channel count from the sample data

func (*NativeSampleData) Length added in v1.0.4

func (s *NativeSampleData) Length() int

Length returns the sample length from the sample data

func (*NativeSampleData) Seek added in v1.0.4

func (s *NativeSampleData) Seek(pos int)

Seek sets the current position in the sample data

func (*NativeSampleData) Tell added in v1.0.4

func (s *NativeSampleData) Tell() int

Tell returns the current position in the sample data

type Sample

type Sample interface {
	SampleReader
	Channels() int
	Length() int
	Seek(pos int)
	Tell() int
}

Sample is the interface to a sample

func ConvertTo added in v1.0.3

func ConvertTo(from Sample, format SampleDataFormat) (Sample, error)

func NewSample

func NewSample(data []byte, length int, channels int, format SampleDataFormat) Sample

NewSample constructs a sampler that can handle the requested sampler format

func NewSampleNative added in v1.0.4

func NewSampleNative(data []volume.Volume, length int, channels int) Sample

type Sample16BitSigned

type Sample16BitSigned int16

Sample16BitSigned is a signed 16-bit sample

func (*Sample16BitSigned) ReadAt

func (s *Sample16BitSigned) ReadAt(d *SampleData, ofs int64) error

ReadAt reads a value from the reader provided in the byte order provided

func (Sample16BitSigned) Size

func (s Sample16BitSigned) Size() int

Size returns the size of the sample in bytes

func (Sample16BitSigned) Volume

func (s Sample16BitSigned) Volume() volume.Volume

Volume returns the volume value for the sample

type Sample16BitUnsigned

type Sample16BitUnsigned uint16

Sample16BitUnsigned is an unsigned 16-bit sample

func (*Sample16BitUnsigned) ReadAt

func (s *Sample16BitUnsigned) ReadAt(d *SampleData, ofs int64) error

ReadAt reads a value from the reader provided in the byte order provided

func (Sample16BitUnsigned) Size

func (s Sample16BitUnsigned) Size() int

Size returns the size of the sample in bytes

func (Sample16BitUnsigned) Volume

func (s Sample16BitUnsigned) Volume() volume.Volume

Volume returns the volume value for the sample

type Sample32BitFloat added in v1.0.3

type Sample32BitFloat float32

Sample32BitFloat is a 32-bit floating-point sample

func (*Sample32BitFloat) ReadAt added in v1.0.3

func (s *Sample32BitFloat) ReadAt(d *SampleData, ofs int64) error

ReadAt reads a value from the reader provided in the byte order provided

func (Sample32BitFloat) Size added in v1.0.3

func (s Sample32BitFloat) Size() int

Size returns the size of the sample in bytes

func (Sample32BitFloat) Volume added in v1.0.3

func (s Sample32BitFloat) Volume() volume.Volume

Volume returns the volume value for the sample

type Sample64BitFloat added in v1.0.3

type Sample64BitFloat float64

Sample64BitFloat is a 64-bit floating-point sample

func (*Sample64BitFloat) ReadAt added in v1.0.3

func (s *Sample64BitFloat) ReadAt(d *SampleData, ofs int64) error

ReadAt reads a value from the reader provided in the byte order provided

func (Sample64BitFloat) Size added in v1.0.3

func (s Sample64BitFloat) Size() int

Size returns the size of the sample in bytes

func (Sample64BitFloat) Volume added in v1.0.3

func (s Sample64BitFloat) Volume() volume.Volume

Volume returns the volume value for the sample

type Sample8BitSigned

type Sample8BitSigned int8

Sample8BitSigned is a signed 8-bit sample

func (*Sample8BitSigned) ReadAt

func (s *Sample8BitSigned) ReadAt(d *SampleData, ofs int64) error

ReadAt reads a value from the reader provided in the byte order provided

func (Sample8BitSigned) Size

func (s Sample8BitSigned) Size() int

Size returns the size of the sample in bytes

func (Sample8BitSigned) Volume

func (s Sample8BitSigned) Volume() volume.Volume

Volume returns the volume value for the sample

type Sample8BitUnsigned

type Sample8BitUnsigned uint8

Sample8BitUnsigned is an unsigned 8-bit sample

func (*Sample8BitUnsigned) ReadAt

func (s *Sample8BitUnsigned) ReadAt(d *SampleData, ofs int64) error

ReadAt reads a value from the reader provided in the byte order provided

func (Sample8BitUnsigned) Size

func (s Sample8BitUnsigned) Size() int

Size returns the size of the sample in bytes

func (Sample8BitUnsigned) Volume

func (s Sample8BitUnsigned) Volume() volume.Volume

Volume returns the volume value for the sample

type SampleConverter

type SampleConverter interface {
	Volume() volume.Volume
	Size() int
	ReadAt(s *SampleData, ofs int64) error
}

SampleConverter is an interface to a sample converter

type SampleData

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

func (*SampleData) Channels

func (s *SampleData) Channels() int

Channels returns the channel count from the sample data

func (*SampleData) Length

func (s *SampleData) Length() int

Length returns the sample length from the sample data

func (*SampleData) Seek

func (s *SampleData) Seek(pos int)

Seek sets the current position in the sample data

func (*SampleData) Tell

func (s *SampleData) Tell() int

Tell returns the current position in the sample data

type SampleDataFormat

type SampleDataFormat uint8

SampleDataFormat is the format of the sample data

type SampleReader

type SampleReader interface {
	Read(arg ...volume.Matrix) (volume.Matrix, error)
}

SampleReader is a reader interface that can return a whole multichannel sample at the current position

type SampleReader16BitSigned

type SampleReader16BitSigned struct {
	SampleData
}

SampleReader16BitSigned is a signed 8-bit PCM sample reader

func (*SampleReader16BitSigned) Read

Read returns the next multichannel sample

type SampleReader16BitUnsigned

type SampleReader16BitUnsigned struct {
	SampleData
}

SampleReader16BitUnsigned is an unsigned 8-bit PCM sample reader

func (*SampleReader16BitUnsigned) Read

Read returns the next multichannel sample

type SampleReader32BitFloat added in v1.0.3

type SampleReader32BitFloat struct {
	SampleData
}

SampleReader32BitFloat is a 32-bit floating-point PCM sample reader

func (*SampleReader32BitFloat) Read added in v1.0.3

Read returns the next multichannel sample

type SampleReader64BitFloat added in v1.0.3

type SampleReader64BitFloat struct {
	SampleData
}

SampleReader64BitFloat is a 64-bit floating-point PCM sample reader

func (*SampleReader64BitFloat) Read added in v1.0.3

Read returns the next multichannel sample

type SampleReader8BitSigned

type SampleReader8BitSigned struct {
	SampleData
}

SampleReader8BitSigned is a signed 8-bit PCM sample reader

func (*SampleReader8BitSigned) Read

Read returns the next multichannel sample

type SampleReader8BitUnsigned

type SampleReader8BitUnsigned struct {
	SampleData
}

SampleReader8BitUnsigned is an unsigned 8-bit PCM sample reader

func (*SampleReader8BitUnsigned) Read

Read returns the next multichannel sample

type SampleReaderNative added in v1.0.4

type SampleReaderNative struct {
	NativeSampleData
}

SampleReaderNative is a native (pre-converted) PCM sample reader

func (*SampleReaderNative) Read added in v1.0.4

func (s *SampleReaderNative) Read(arg ...volume.Matrix) (volume.Matrix, error)

Read returns the next multichannel sample

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