YARP
Yet Another Robot Platform
yarp::dev::AudioRecorderDeviceBase Class Reference

#include <yarp/dev/AudioRecorderDeviceBase.h>

+ Inheritance diagram for yarp::dev::AudioRecorderDeviceBase:

Public Member Functions

virtual bool getSound (yarp::sig::Sound &sound, size_t min_number_of_samples, size_t max_number_of_samples, double max_samples_timeout_s) override
 Get a sound from a device. More...
 
virtual bool startRecording () override
 Start the recording. More...
 
virtual bool stopRecording () override
 Stop the recording. More...
 
virtual bool getRecordingAudioBufferMaxSize (yarp::dev::AudioBufferSize &size) override
 
virtual bool getRecordingAudioBufferCurrentSize (yarp::dev::AudioBufferSize &size) override
 
virtual bool resetRecordingAudioBuffer () override
 
virtual ~AudioRecorderDeviceBase ()
 
- Public Member Functions inherited from yarp::dev::IAudioGrabberSound
virtual ~IAudioGrabberSound ()
 Destructor. More...
 

Protected Attributes

bool m_isRecording = false
 
std::mutex m_mutex
 
yarp::dev::CircularAudioBuffer_16tm_inputBuffer = nullptr
 
AudioDeviceDriverSettings m_audiorecorder_cfg
 

Detailed Description

Definition at line 33 of file AudioRecorderDeviceBase.h.

Constructor & Destructor Documentation

◆ ~AudioRecorderDeviceBase()

AudioRecorderDeviceBase::~AudioRecorderDeviceBase ( )
virtual

Definition at line 168 of file AudioRecorderDeviceBase.cpp.

Member Function Documentation

◆ getRecordingAudioBufferCurrentSize()

bool AudioRecorderDeviceBase::getRecordingAudioBufferCurrentSize ( yarp::dev::AudioBufferSize size)
overridevirtual

Implements yarp::dev::IAudioGrabberSound.

Definition at line 129 of file AudioRecorderDeviceBase.cpp.

◆ getRecordingAudioBufferMaxSize()

bool AudioRecorderDeviceBase::getRecordingAudioBufferMaxSize ( yarp::dev::AudioBufferSize size)
overridevirtual

Implements yarp::dev::IAudioGrabberSound.

Definition at line 121 of file AudioRecorderDeviceBase.cpp.

◆ getSound()

bool AudioRecorderDeviceBase::getSound ( yarp::sig::Sound sound,
size_t  min_number_of_samples,
size_t  max_number_of_samples,
double  max_samples_timeout_s 
)
overridevirtual

Get a sound from a device.

Examples: getSound(s, 0, 100, 0.1); returns a sound whose size can vary between 0 and 100, with a maximum blocking time of 0.1 getSound(s, 100, 100, 0.0); returns a sound with exact size of 100. It may block forever (more specifically, until sound size is at least 100). getSound(s, 100, 100000, 0.0); returns a sound with a minimum size of 0, while trying to transfer all the internal buffer. It may block forever (more specifically, until sound size is at least 100).

Parameters
soundthe sound to be filled
min_number_of_samples.The function will block until the driver is able to collect at least min_number_of_samples. If set to zero, the function may return empty sounds.
max_number_of_samples.The function will block until the driver is either able to collect max_number_of_samples or the timeout expires.
max_samples_timeout_s.The timeout (in seconds) to retrieve max_number_of_samples.
Returns
true upon success, false for an invalid set of parameters, such as max_number_of_samples<min_number_of_samples, etc.

Implements yarp::dev::IAudioGrabberSound.

Definition at line 35 of file AudioRecorderDeviceBase.cpp.

◆ resetRecordingAudioBuffer()

bool AudioRecorderDeviceBase::resetRecordingAudioBuffer ( )
overridevirtual

Implements yarp::dev::IAudioGrabberSound.

Definition at line 137 of file AudioRecorderDeviceBase.cpp.

◆ startRecording()

bool AudioRecorderDeviceBase::startRecording ( )
overridevirtual

Start the recording.

Returns
true/false upon success/failure

Implements yarp::dev::IAudioGrabberSound.

Reimplemented in PortAudioRecorderDeviceDriver.

Definition at line 145 of file AudioRecorderDeviceBase.cpp.

◆ stopRecording()

bool AudioRecorderDeviceBase::stopRecording ( )
overridevirtual

Stop the recording.

Returns
true/false upon success/failure

Implements yarp::dev::IAudioGrabberSound.

Reimplemented in PortAudioRecorderDeviceDriver.

Definition at line 157 of file AudioRecorderDeviceBase.cpp.

Member Data Documentation

◆ m_audiorecorder_cfg

AudioDeviceDriverSettings yarp::dev::AudioRecorderDeviceBase::m_audiorecorder_cfg
protected

Definition at line 40 of file AudioRecorderDeviceBase.h.

◆ m_inputBuffer

yarp::dev::CircularAudioBuffer_16t* yarp::dev::AudioRecorderDeviceBase::m_inputBuffer = nullptr
protected

Definition at line 38 of file AudioRecorderDeviceBase.h.

◆ m_isRecording

bool yarp::dev::AudioRecorderDeviceBase::m_isRecording = false
protected

Definition at line 36 of file AudioRecorderDeviceBase.h.

◆ m_mutex

std::mutex yarp::dev::AudioRecorderDeviceBase::m_mutex
protected

Definition at line 37 of file AudioRecorderDeviceBase.h.


The documentation for this class was generated from the following files: