Documentation
¶
Index ¶
- Constants
- Variables
- type NativeSampleData
- type PCMReader
- type Sample
- type Sample16BitSigned
- type Sample16BitUnsigned
- type Sample32BitFloat
- type Sample64BitFloat
- type Sample8BitSigned
- type Sample8BitUnsigned
- type SampleConverter
- type SampleData
- type SampleDataFormat
- type SampleReader
- type SampleReaderNative
- type SampleType
Constants ¶
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 ¶
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 PCMReader ¶ added in v1.1.0
type PCMReader[TConverter SampleConverter] struct { SampleData // contains filtered or unexported fields }
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)
type Sample16BitSigned ¶
type Sample16BitSigned struct{}
Sample16BitSigned is a signed 16-bit sample
func (Sample16BitSigned) ReadAt ¶
func (s Sample16BitSigned) ReadAt(d *SampleData, ofs int64) (volume.Volume, 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
type Sample16BitUnsigned ¶
type Sample16BitUnsigned struct{}
Sample16BitUnsigned is an unsigned 16-bit sample
func (Sample16BitUnsigned) ReadAt ¶
func (s Sample16BitUnsigned) ReadAt(d *SampleData, ofs int64) (volume.Volume, 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
type Sample32BitFloat ¶ added in v1.0.3
type Sample32BitFloat struct{}
Sample32BitFloat is a 32-bit floating-point sample
func (Sample32BitFloat) ReadAt ¶ added in v1.0.3
func (s Sample32BitFloat) ReadAt(d *SampleData, ofs int64) (volume.Volume, 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
type Sample64BitFloat ¶ added in v1.0.3
type Sample64BitFloat struct{}
Sample64BitFloat is a 64-bit floating-point sample
func (Sample64BitFloat) ReadAt ¶ added in v1.0.3
func (s Sample64BitFloat) ReadAt(d *SampleData, ofs int64) (volume.Volume, 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
type Sample8BitSigned ¶
type Sample8BitSigned struct{}
Sample8BitSigned is a signed 8-bit sample
func (Sample8BitSigned) ReadAt ¶
func (s Sample8BitSigned) ReadAt(d *SampleData, ofs int64) (volume.Volume, 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
type Sample8BitUnsigned ¶
type Sample8BitUnsigned struct{}
Sample8BitUnsigned is an unsigned 8-bit sample
func (Sample8BitUnsigned) ReadAt ¶
func (s Sample8BitUnsigned) ReadAt(d *SampleData, ofs int64) (volume.Volume, 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
type SampleConverter ¶
type SampleConverter interface { Size() int ReadAt(s *SampleData, ofs int64) (volume.Volume, 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 ¶
SampleReader is a reader interface that can return a whole multichannel sample at the current position
type SampleReaderNative ¶ added in v1.0.4
type SampleReaderNative struct {
NativeSampleData
}
SampleReaderNative is a native (pre-converted) PCM sample reader