Documentation
¶
Index ¶
- Constants
- Variables
- func ReadFromAnything(dst interface{}, src interface{}, num int) error
- func ReadFromFloat32(dst interface{}, src []float32, num int) error
- func ReadFromInt16(dst interface{}, src []int16, num int) error
- func ReadFromInt32(dst interface{}, src []int32, num int) error
- func ReadFromInt8(dst interface{}, src []int8, num int) error
- func SliceLength(slice interface{}) int
- type DevicePair
- type Filter
- type NumberType
- type OfflineStream
- func (o *OfflineStream) Close()
- func (o *OfflineStream) Read(dst interface{}) (int, error)
- func (o *OfflineStream) ReadBytes(rd io.Reader, bo binary.ByteOrder, numType NumberType) error
- func (o *OfflineStream) SampleRate() int
- func (o *OfflineStream) WriteBytes(b []byte, bo binary.ByteOrder, numType NumberType) error
- func (o *OfflineStream) WriteValues(val interface{}) error
- type PlaybackDevice
- type RecordingDevice
- type Stream
Constants ¶
const ( Int8 = iota Int16 Int32 Float32 )
Possible NumberTypes
Variables ¶
var ErrBufferTooLarge = errors.New("audio: buffer is too large")
ErrBufferTooLarge is returned when the audio buffer received is too large to process. This commonly occurs with streams for realtime applications.
var ErrInvalidNumberType = errors.New("audio: invalid number type")
ErrInvalidNumberType is returned if an invalid number type is provided, mainly to offline streams.
var ErrInvalidReadDestination = errors.New("audio: invalid read destination")
ErrInvalidReadDestination is returned if the destination of a ReadFrom function call is not a valid audio slice.
Functions ¶
func ReadFromAnything ¶
ReadFromAnything converts between any valid audio slice.
func ReadFromFloat32 ¶
ReadFromFloat32 converts a []float32 to any other valid audio slice.
func ReadFromInt16 ¶
ReadFromInt16 converts an []int16 to any other valid audio slice.
func ReadFromInt32 ¶
ReadFromInt32 converts an []int32 to any other valid audio slice.
func ReadFromInt8 ¶
ReadFromInt8 converts an []int8 to any other valid audio slice.
func SliceLength ¶
func SliceLength(slice interface{}) int
SliceLength returns the length of a valid audio slice.
Types ¶
type DevicePair ¶
type DevicePair struct { Playback PlaybackDevice Record RecordingDevice }
DevicePair represents a pair of a playback and recording device.
func (*DevicePair) Close ¶
func (a *DevicePair) Close()
Close closes both the playback and recording devices of a device pair.
type OfflineStream ¶
type OfflineStream struct { Stream // contains filtered or unexported fields }
OfflineStream represents a stream which is wrapped and is usually based on a different stream of bytes or numbers, such as over a network.
func NewOfflineStream ¶
func NewOfflineStream(sampleRate int, bufferSize int) *OfflineStream
NewOfflineStream returns an offline stream, a simple buffered stream that allows you to convert io.Read/Write operations into a stream. Buffer size is measured by number of samples.
func (*OfflineStream) Close ¶
func (o *OfflineStream) Close()
Close closes the offline stream, and causes any ongoing reads to return.
func (*OfflineStream) Read ¶
func (o *OfflineStream) Read(dst interface{}) (int, error)
func (*OfflineStream) ReadBytes ¶
func (o *OfflineStream) ReadBytes(rd io.Reader, bo binary.ByteOrder, numType NumberType) error
ReadBytes reads bytes of values into the offline stream.
func (*OfflineStream) SampleRate ¶
func (o *OfflineStream) SampleRate() int
SampleRate returns the sample rate of the offline stream.
func (*OfflineStream) WriteBytes ¶
func (o *OfflineStream) WriteBytes(b []byte, bo binary.ByteOrder, numType NumberType) error
WriteBytes writes bytes of values into the offline stream.
func (*OfflineStream) WriteValues ¶
func (o *OfflineStream) WriteValues(val interface{}) error
WriteValues writes a slice of number values into the offline stream.
type PlaybackDevice ¶
PlaybackDevice represents a playback device that can play a stream.
type RecordingDevice ¶
RecordingDevice represents a recording device that can open a stream.
type Stream ¶
Stream represents an audio stream.
func NewRealtimeStream ¶
NewRealtimeStream converts a stream into a buffered stream for use in realtime applications, such as audio over a network.