YARP
Yet Another Robot Platform
yarp::dev::IAudioGrabberSound Class Referenceabstract

Read a YARP-format sound block from a device. More...

#include <yarp/dev/IAudioGrabberSound.h>

+ Inheritance diagram for yarp::dev::IAudioGrabberSound:

Public Member Functions

virtual ~IAudioGrabberSound ()
 Destructor. More...
 
virtual bool getSound (yarp::sig::Sound &sound, size_t min_number_of_samples, size_t max_number_of_samples, double max_samples_timeout_s)=0
 Get a sound from a device. More...
 
virtual bool startRecording ()=0
 Start the recording. More...
 
virtual bool stopRecording ()=0
 Stop the recording. More...
 
virtual bool isRecording (bool &recording_enabled)=0
 Check if the recording has been enabled (e.g. More...
 
virtual bool getRecordingAudioBufferMaxSize (yarp::dev::AudioBufferSize &size)=0
 
virtual bool getRecordingAudioBufferCurrentSize (yarp::dev::AudioBufferSize &size)=0
 
virtual bool resetRecordingAudioBuffer ()=0
 
virtual bool setSWGain (double gain)=0
 Sets a software gain for the grabbed audio. More...
 
virtual bool setHWGain (double gain)=0
 Sets the hardware gain of the grabbing device (if supported by the hardware) More...
 

Detailed Description

Read a YARP-format sound block from a device.

Definition at line 22 of file IAudioGrabberSound.h.

Constructor & Destructor Documentation

◆ ~IAudioGrabberSound()

yarp::dev::IAudioGrabberSound::~IAudioGrabberSound ( )
virtualdefault

Destructor.

Member Function Documentation

◆ getRecordingAudioBufferCurrentSize()

virtual bool yarp::dev::IAudioGrabberSound::getRecordingAudioBufferCurrentSize ( yarp::dev::AudioBufferSize size)
pure virtual

◆ getRecordingAudioBufferMaxSize()

virtual bool yarp::dev::IAudioGrabberSound::getRecordingAudioBufferMaxSize ( yarp::dev::AudioBufferSize size)
pure virtual

◆ getSound()

virtual bool yarp::dev::IAudioGrabberSound::getSound ( yarp::sig::Sound sound,
size_t  min_number_of_samples,
size_t  max_number_of_samples,
double  max_samples_timeout_s 
)
pure virtual

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.

Implemented in yarp::dev::AudioRecorderDeviceBase, PortAudioDeviceDriver, and FfmpegGrabber.

◆ isRecording()

virtual bool yarp::dev::IAudioGrabberSound::isRecording ( bool &  recording_enabled)
pure virtual

Check if the recording has been enabled (e.g.

via startRecording()/stopRecording())

Parameters
recording_enabledthe status of the device
Returns
true/false upon success/failure

Implemented in yarp::dev::AudioRecorderDeviceBase, PortAudioDeviceDriver, and FfmpegGrabber.

◆ resetRecordingAudioBuffer()

virtual bool yarp::dev::IAudioGrabberSound::resetRecordingAudioBuffer ( )
pure virtual

◆ setHWGain()

virtual bool yarp::dev::IAudioGrabberSound::setHWGain ( double  gain)
pure virtual

Sets the hardware gain of the grabbing device (if supported by the hardware)

Parameters
gainthe audio gain (1.0 is the default value)
Returns
true/false upon success/failure

Implemented in PortAudioRecorderDeviceDriver, PortAudioDeviceDriver, FfmpegGrabber, fakeMicrophone, and audioFromFileDevice.

◆ setSWGain()

virtual bool yarp::dev::IAudioGrabberSound::setSWGain ( double  gain)
pure virtual

Sets a software gain for the grabbed audio.

Parameters
gainthe audio gain (1.0 is the default value)
Returns
true/false upon success/failure

Implemented in yarp::dev::AudioRecorderDeviceBase, PortAudioDeviceDriver, and FfmpegGrabber.

◆ startRecording()

virtual bool yarp::dev::IAudioGrabberSound::startRecording ( )
pure virtual

Start the recording.

Returns
true/false upon success/failure

Implemented in yarp::dev::AudioRecorderDeviceBase, PortAudioRecorderDeviceDriver, PortAudioDeviceDriver, and FfmpegGrabber.

◆ stopRecording()

virtual bool yarp::dev::IAudioGrabberSound::stopRecording ( )
pure virtual

Stop the recording.

Returns
true/false upon success/failure

Implemented in yarp::dev::AudioRecorderDeviceBase, PortAudioRecorderDeviceDriver, PortAudioDeviceDriver, and FfmpegGrabber.


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