Documentation ¶
Index ¶
- Variables
- func GetAvailableDevices() ([]string, error)
- type PvRecorder
- func (pvRecorder *PvRecorder) Delete()
- func (pvRecorder *PvRecorder) GetSelectedDevice() string
- func (pvRecorder *PvRecorder) Init() error
- func (pvRecorder *PvRecorder) IsRecording() bool
- func (pvRecorder *PvRecorder) Read() ([]int16, error)
- func (pvRecorder *PvRecorder) SetDebugLogging(isDebugLoggingEnabled bool)
- func (pvRecorder *PvRecorder) Start() error
- func (pvRecorder *PvRecorder) Stop() error
- type PvRecorderStatus
Constants ¶
This section is empty.
Variables ¶
var ( // SampleRate Audio sample rate used by PvRecorder. SampleRate int // Version PvRecorder version Version string )
Functions ¶
func GetAvailableDevices ¶
GetAvailableDevices function gets the currently available input audio devices.
Types ¶
type PvRecorder ¶
type PvRecorder struct { // Length of each frame returned from read command. FrameLength int // Index of audio device to start recording and capture audio. DeviceIndex int // BufferedFramesCount is the number of audio frames buffered internally for reading - i.e. internal circular buffer // will be of size `frame_length` * `buffered_frames_count`. If this value is too low, buffer overflows could occur. BufferedFramesCount int // contains filtered or unexported fields }
PvRecorder struct
func NewPvRecorder ¶
func NewPvRecorder(frameLength int) PvRecorder
NewPvRecorder returns a PvRecorder struct with default parameters
func (*PvRecorder) Delete ¶
func (pvRecorder *PvRecorder) Delete()
Delete function releases resources acquired by PvRecorder
func (*PvRecorder) GetSelectedDevice ¶
func (pvRecorder *PvRecorder) GetSelectedDevice() string
GetSelectedDevice gets the current selected audio input device name
func (*PvRecorder) IsRecording ¶
func (pvRecorder *PvRecorder) IsRecording() bool
IsRecording gets whether the given instance is currently recording audio or not.
func (*PvRecorder) Read ¶
func (pvRecorder *PvRecorder) Read() ([]int16, error)
Read function reads audio frames.
func (*PvRecorder) SetDebugLogging ¶
func (pvRecorder *PvRecorder) SetDebugLogging(isDebugLoggingEnabled bool)
SetDebugLogging enables or disables debug logging for PvRecorder. Debug logs will indicate when there are overflows in the internal frame buffer and when an audio source is generating frames of silence.
func (*PvRecorder) Start ¶
func (pvRecorder *PvRecorder) Start() error
Start function starts recording audio.
func (*PvRecorder) Stop ¶
func (pvRecorder *PvRecorder) Stop() error
Stop function stops recording audio.
type PvRecorderStatus ¶
type PvRecorderStatus int
PvRecorderStatus type
const ( SUCCESS PvRecorderStatus = 0 OUT_OF_MEMORY PvRecorderStatus = 1 INVALID_ARGUMENT PvRecorderStatus = 2 INVALID_STATE PvRecorderStatus = 3 BACKEND_ERROR PvRecorderStatus = 4 DEVICE_ALREADY_INITIALIZED PvRecorderStatus = 5 DEVICE_NOT_INITIALIZED PvRecorderStatus = 6 IO_ERROR PvRecorderStatus = 7 RUNTIME_ERROR PvRecorderStatus = 8 )
PvRecorder status return codes from C library