audioToFileDevice
: This device driver, wrapped by default by AudioPlayerWrapper, is used to save to a file an audio stream.
More...
#include <audioToFileDevice/audioToFileDevice.h>
Public Member Functions | |
audioToFileDevice () | |
audioToFileDevice (const audioToFileDevice &)=delete | |
audioToFileDevice (audioToFileDevice &&)=delete | |
audioToFileDevice & | operator= (const audioToFileDevice &)=delete |
audioToFileDevice & | operator= (audioToFileDevice &&)=delete |
~audioToFileDevice () override | |
bool | open (yarp::os::Searchable &config) override |
Open the DeviceDriver. More... | |
bool | close () override |
Close the DeviceDriver. More... | |
virtual bool | renderSound (const yarp::sig::Sound &sound) override |
Render a sound using a device (i.e. More... | |
virtual bool | startPlayback () override |
Start the playback. More... | |
virtual bool | stopPlayback () override |
Stop the playback. More... | |
virtual bool | setHWGain (double gain) override |
Sets the hardware gain of the playback device (if supported by the hardware) More... | |
virtual bool | configureDeviceAndStart () override |
virtual bool | interruptDeviceAndClose () override |
virtual void | waitUntilPlaybackStreamIsComplete () override |
![]() | |
DeviceDriver () | |
DeviceDriver (const DeviceDriver &other)=delete | |
DeviceDriver (DeviceDriver &&other) noexcept=delete | |
DeviceDriver & | operator= (const DeviceDriver &other)=delete |
DeviceDriver & | operator= (DeviceDriver &&other) noexcept=delete |
~DeviceDriver () override | |
bool | open (yarp::os::Searchable &config) override |
Open the DeviceDriver. More... | |
bool | close () override |
Close the DeviceDriver. More... | |
virtual std::string | id () const |
Return the id assigned to the PolyDriver. More... | |
virtual void | setId (const std::string &id) |
Set the id for this device. More... | |
template<class T > | |
bool | view (T *&x) |
Get an interface to the device driver. More... | |
virtual DeviceDriver * | getImplementation () |
Some drivers are bureaucrats, pointing at others. More... | |
![]() | |
virtual | ~IConfig () |
Destructor. More... | |
virtual bool | open (Searchable &config) |
Initialize the object. More... | |
virtual bool | close () |
Shut the object down. More... | |
virtual bool | configure (Searchable &config) |
Change online parameters. More... | |
![]() | |
virtual bool | renderSound (const yarp::sig::Sound &sound) override |
Render a sound using a device (i.e. More... | |
virtual bool | startPlayback () override |
Start the playback. More... | |
virtual bool | stopPlayback () override |
Stop the playback. More... | |
virtual bool | isPlaying (bool &playback_enabled) override |
Check if the playback has been enabled (e.g. More... | |
virtual bool | getPlaybackAudioBufferMaxSize (yarp::dev::AudioBufferSize &size) override |
virtual bool | getPlaybackAudioBufferCurrentSize (yarp::dev::AudioBufferSize &size) override |
virtual bool | resetPlaybackAudioBuffer () override |
virtual bool | setSWGain (double gain) override |
Sets a software gain for the played audio. More... | |
virtual | ~AudioPlayerDeviceBase () |
![]() | |
virtual | ~IAudioRender () |
Destructor. More... | |
virtual bool | renderSound (const yarp::sig::Sound &sound)=0 |
Render a sound using a device (i.e. More... | |
virtual bool | startPlayback ()=0 |
Start the playback. More... | |
virtual bool | stopPlayback ()=0 |
Stop the playback. More... | |
virtual bool | isPlaying (bool &playback_enabled)=0 |
Check if the playback has been enabled (e.g. More... | |
virtual bool | getPlaybackAudioBufferMaxSize (yarp::dev::AudioBufferSize &size)=0 |
virtual bool | getPlaybackAudioBufferCurrentSize (yarp::dev::AudioBufferSize &size)=0 |
virtual bool | resetPlaybackAudioBuffer ()=0 |
virtual bool | setSWGain (double gain)=0 |
Sets a software gain for the played audio. More... | |
virtual bool | setHWGain (double gain)=0 |
Sets the hardware gain of the playback device (if supported by the hardware) More... | |
Additional Inherited Members | |
![]() | |
enum | { RENDER_APPEND = 0 , RENDER_IMMEDIATE = 1 } |
![]() | |
virtual bool | configureDeviceAndStart ()=0 |
virtual bool | interruptDeviceAndClose ()=0 |
virtual void | waitUntilPlaybackStreamIsComplete () |
virtual bool | immediateSound (const yarp::sig::Sound &sound) |
virtual bool | appendSound (const yarp::sig::Sound &sound) |
bool | configurePlayerAudioDevice (yarp::os::Searchable &config, std::string device_name) |
![]() | |
bool | m_enable_buffer_autoclear = false |
bool | m_playback_enabled = false |
std::recursive_mutex | m_mutex |
yarp::dev::CircularAudioBuffer_16t * | m_outputBuffer = nullptr |
AudioDeviceDriverSettings | m_audioplayer_cfg |
double | m_sw_gain = 1.0 |
double | m_hw_gain = 1.0 |
bool | m_audiobase_debug = false |
enum yarp::dev::AudioPlayerDeviceBase:: { ... } | m_renderMode = RENDER_APPEND |
audioToFileDevice
: This device driver, wrapped by default by AudioPlayerWrapper, is used to save to a file an audio stream.
Three different operating modes are available, defined by the optional string parameter save_mode
: if save_mode == "append_data", the file is written only when the module terminates. Every start/stop operation just pauses the module. On resume, the new data is concatenated at the end of the file.
if save_mode == "overwrite_file", the output file is written every time the stop() method is called or when the module terminates. If the file already exists, it will be overwritten with the new data.
if save_mode = "rename_file", the output file is written to a NEW file every time the stop() method is called or when the module terminates. The file name is modified, using an incremental counter appended at the end of the file name.
if save_mode = "break_file", the output file is written to a NEW file every time a yarp::sig::sound is received or when the module terminates. The file name is modified, using an incremental counter appended at the end of the file name.
This device driver derives from AudioPlayerDeviceBase base class. Please check its documentation for additional details.
Parameters required by this device are:
Parameter name | SubParameter | Type | Units | Default Value | Required | Description | Notes |
---|---|---|---|---|---|---|---|
AUDIO_BASE | *** | - | - | No | For the documentation of AUDIO_BASE group, please refer to the documentation of the base class AudioPlayerDeviceBase | ||
file_name | - | string | - | audio_out.wav | No | The name of the file written by the module | Only .wav and .mp3 files are supported |
save_mode | - | string | - | overwrite_file | No | Affects the behavior of the module and defines the save mode, as described in the documentation. | |
add_marker | - | bool | - | - | No | If set, it will add a marker at the beginning and at the ending of each received waveform. |
See Audio in YARP for additional documentation on YARP audio.
Definition at line 48 of file audioToFileDevice.h.
audioToFileDevice::audioToFileDevice | ( | ) |
Definition at line 26 of file audioToFileDevice.cpp.
|
delete |
|
delete |
|
override |
Definition at line 31 of file audioToFileDevice.cpp.
|
overridevirtual |
Close the DeviceDriver.
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 148 of file audioToFileDevice.cpp.
|
overridevirtual |
Implements yarp::dev::AudioPlayerDeviceBase.
Definition at line 205 of file audioToFileDevice.cpp.
|
overridevirtual |
Implements yarp::dev::AudioPlayerDeviceBase.
Definition at line 211 of file audioToFileDevice.cpp.
|
overridevirtual |
Open the DeviceDriver.
config | is a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device). |
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 36 of file audioToFileDevice.cpp.
|
delete |
|
delete |
|
overridevirtual |
Render a sound using a device (i.e.
send it to the speakers).
sound | the sound to be rendered |
Reimplemented from yarp::dev::AudioPlayerDeviceBase.
Definition at line 178 of file audioToFileDevice.cpp.
|
overridevirtual |
Sets the hardware gain of the playback device (if supported by the hardware)
gain | the audio gain (1.0 is the default value) |
Implements yarp::dev::IAudioRender.
Definition at line 194 of file audioToFileDevice.cpp.
|
overridevirtual |
Start the playback.
Reimplemented from yarp::dev::AudioPlayerDeviceBase.
Definition at line 154 of file audioToFileDevice.cpp.
|
overridevirtual |
Stop the playback.
Reimplemented from yarp::dev::AudioPlayerDeviceBase.
Definition at line 166 of file audioToFileDevice.cpp.
|
overridevirtual |
Reimplemented from yarp::dev::AudioPlayerDeviceBase.
Definition at line 217 of file audioToFileDevice.cpp.