Documentation ¶
Overview ¶
Package portaudio provides an implementation of streamio.Player and streamio.Recorder using PortAudio.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListDevices ¶
ListDevices returns a slice of string containing device info on each line.
func OpenStream ¶
func OpenStream(inputDeviceID, outputDeviceID int, numInputChannels, numOutputChannels int, sampleRate float64, framesPerBuffer int, args ...interface{}) (*portaudio.Stream, error)
OpenStream opens a stream with device IDs that portaudio.OpenDefaultStream does not support.
If the device ID is -1, the function uses the default input/output device.
Types ¶
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player is a writable PortAudio output device.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder is a readable PortAudio input device.
func NewRecorder ¶
func NewRecorder(inputDeviceID int, bufferSize int, channels int, bitDepth int, sampleRate int, byteOrder binary.ByteOrder) (r *Recorder, err error)
NewRecorder initialize a Player object.
func (*Recorder) Read ¶
Read reads len(b) bytes from the record buffer into b.
The function blocks until it reads len(b) bytes or more. The function does not support ioutil.ReadAll (blocks permanently).
The first call to this function invokes a goroutine that sequentially reads data from the audio input device and writes the data into the record buffer.