AudioRecorderDeviceBase
: a base class for all audio recorder devices
More...
#include <yarp/dev/AudioRecorderDeviceBase.h>
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. | |
virtual bool | startRecording () override |
Start the recording. | |
virtual bool | stopRecording () override |
Stop the recording. | |
virtual bool | isRecording (bool &recording_enabled) override |
Check if the recording has been enabled (e.g. | |
virtual bool | getRecordingAudioBufferMaxSize (yarp::sig::AudioBufferSize &size) override |
virtual bool | getRecordingAudioBufferCurrentSize (yarp::sig::AudioBufferSize &size) override |
virtual bool | resetRecordingAudioBuffer () override |
virtual bool | setSWGain (double gain) override |
Sets a software gain for the grabbed audio. | |
virtual | ~AudioRecorderDeviceBase () |
Public Member Functions inherited from yarp::dev::IAudioGrabberSound | |
virtual | ~IAudioGrabberSound () |
Destructor. | |
virtual bool | setHWGain (double gain)=0 |
Sets the hardware gain of the grabbing device (if supported by the hardware) | |
Protected Member Functions | |
bool | configureRecorderAudioDevice (yarp::os::Searchable &config, std::string device_name) |
Protected Attributes | |
bool | m_enable_buffer_autoclear = false |
bool | m_recording_enabled = false |
std::mutex | m_mutex |
yarp::dev::CircularAudioBuffer_16t * | m_inputBuffer = nullptr |
double | m_sw_gain = 1.0 |
double | m_hw_gain = 1.0 |
AudioDeviceDriverSettings | m_audiorecorder_cfg |
bool | m_audiobase_debug = false |
int16_t | m_cliptol = 3 |
AudioRecorderDeviceBase
: a base class for all audio recorder devices
Parameters required by this device are:
Parameter name | SubParameter | Type | Units | Default Value | Required | Description | Notes |
---|---|---|---|---|---|---|---|
AUDIO_BASE | rate | int | Hz | 44100 | No | The frequency of the audio device | - |
AUDIO_BASE | samples | int | samples | 44100 | No | The size of the internal buffer (in samples) | A default value identical to device frequency implies a buffer length of 1s |
AUDIO_BASE | channels | int | - | 2 | No | The number of channels | - |
AUDIO_BASE | bits | int | - | 16 | No | Not yet implemented | - |
AUDIO_BASE | hw_gain | double | - | 1.0 | No | The device audio gain. Its implementation is device dependent (and it may also be not implemented) | - |
AUDIO_BASE | sw_gain | double | - | 1.0 | No | A SW gain for audio waveform amplification | - |
AUDIO_BASE | buffer_autoclear | bool | - | true | No | Automatically clear the buffer every time the devices is started/stopped | - |
AUDIO_BASE | debug | bool | - | false | No | Enable debug mode | The value is stored into variable m_audiobase_debug |
See Audio in YARP for additional documentation on YARP audio.
Definition at line 46 of file AudioRecorderDeviceBase.h.
|
virtual |
Definition at line 207 of file AudioRecorderDeviceBase.cpp.
|
protected |
Definition at line 216 of file AudioRecorderDeviceBase.cpp.
|
overridevirtual |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 139 of file AudioRecorderDeviceBase.cpp.
|
overridevirtual |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 126 of file AudioRecorderDeviceBase.cpp.
|
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).
sound | the 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. |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 29 of file AudioRecorderDeviceBase.cpp.
Check if the recording has been enabled (e.g.
via startRecording()/stopRecording())
recording_enabled | the status of the device |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 201 of file AudioRecorderDeviceBase.cpp.
|
overridevirtual |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 162 of file AudioRecorderDeviceBase.cpp.
Sets a software gain for the grabbed audio.
gain | the audio gain (1.0 is the default value) |
Implements yarp::dev::IAudioGrabberSound.
Definition at line 151 of file AudioRecorderDeviceBase.cpp.
|
overridevirtual |
Start the recording.
Implements yarp::dev::IAudioGrabberSound.
Reimplemented in PortAudioRecorderDeviceDriver.
Definition at line 175 of file AudioRecorderDeviceBase.cpp.
|
overridevirtual |
Stop the recording.
Implements yarp::dev::IAudioGrabberSound.
Reimplemented in AudioFromFileDevice, and PortAudioRecorderDeviceDriver.
Definition at line 187 of file AudioRecorderDeviceBase.cpp.
|
protected |
Definition at line 56 of file AudioRecorderDeviceBase.h.
|
protected |
Definition at line 55 of file AudioRecorderDeviceBase.h.
|
protected |
Definition at line 57 of file AudioRecorderDeviceBase.h.
|
protected |
Definition at line 49 of file AudioRecorderDeviceBase.h.
|
protected |
Definition at line 54 of file AudioRecorderDeviceBase.h.
|
protected |
Definition at line 52 of file AudioRecorderDeviceBase.h.
|
protected |
Definition at line 51 of file AudioRecorderDeviceBase.h.
|
protected |
Definition at line 50 of file AudioRecorderDeviceBase.h.
|
protected |
Definition at line 53 of file AudioRecorderDeviceBase.h.