YARP
Yet Another Robot Platform
audioToFileDevice Class Reference

audioToFileDevice : This device driver, wrapped by default by AudioPlayerWrapper, is used to save to a file an audio stream. More...

#include <audioToFileDevice/audioToFileDevice.h>

+ Inheritance diagram for audioToFileDevice:

Public Member Functions

 audioToFileDevice ()
 
 audioToFileDevice (const audioToFileDevice &)=delete
 
 audioToFileDevice (audioToFileDevice &&)=delete
 
audioToFileDeviceoperator= (const audioToFileDevice &)=delete
 
audioToFileDeviceoperator= (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
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
 ~DeviceDriver () override=default
 Destructor. More...
 
template<class T >
bool view (T *&x)
 Get an interface to the device driver. More...
 
virtual DeviceDrivergetImplementation ()
 Some drivers are bureaucrats, pointing at others. More...
 
- Public Member Functions inherited from yarp::os::IConfig
virtual ~IConfig ()
 Destructor. More...
 
virtual bool configure (Searchable &config)
 Change online parameters. More...
 
- Public Member Functions inherited from yarp::dev::AudioPlayerDeviceBase
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 ()
 
- Public Member Functions inherited from yarp::dev::IAudioRender
virtual ~IAudioRender ()
 Destructor. More...
 

Additional Inherited Members

- Protected Types inherited from yarp::dev::AudioPlayerDeviceBase
enum  {
  RENDER_APPEND = 0 ,
  RENDER_IMMEDIATE = 1
}
 
- Protected Member Functions inherited from yarp::dev::AudioPlayerDeviceBase
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)
 
- Protected Attributes inherited from yarp::dev::AudioPlayerDeviceBase
bool m_enable_buffer_autoclear = false
 
bool m_playback_enabled = false
 
std::recursive_mutex m_mutex
 
yarp::dev::CircularAudioBuffer_16tm_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
 

Detailed Description

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 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.

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.

See Audio in YARP for additional documentation on YARP audio.

Definition at line 44 of file audioToFileDevice.h.

Constructor & Destructor Documentation

◆ audioToFileDevice() [1/3]

audioToFileDevice::audioToFileDevice ( )

Definition at line 26 of file audioToFileDevice.cpp.

◆ audioToFileDevice() [2/3]

audioToFileDevice::audioToFileDevice ( const audioToFileDevice )
delete

◆ audioToFileDevice() [3/3]

audioToFileDevice::audioToFileDevice ( audioToFileDevice &&  )
delete

◆ ~audioToFileDevice()

audioToFileDevice::~audioToFileDevice ( )
override

Definition at line 31 of file audioToFileDevice.cpp.

Member Function Documentation

◆ close()

bool audioToFileDevice::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 112 of file audioToFileDevice.cpp.

◆ configureDeviceAndStart()

bool audioToFileDevice::configureDeviceAndStart ( )
overridevirtual

Implements yarp::dev::AudioPlayerDeviceBase.

Definition at line 163 of file audioToFileDevice.cpp.

◆ interruptDeviceAndClose()

bool audioToFileDevice::interruptDeviceAndClose ( )
overridevirtual

Implements yarp::dev::AudioPlayerDeviceBase.

Definition at line 169 of file audioToFileDevice.cpp.

◆ open()

bool audioToFileDevice::open ( yarp::os::Searchable config)
overridevirtual

Open the DeviceDriver.

Parameters
configis 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).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 36 of file audioToFileDevice.cpp.

◆ operator=() [1/2]

audioToFileDevice& audioToFileDevice::operator= ( audioToFileDevice &&  )
delete

◆ operator=() [2/2]

audioToFileDevice& audioToFileDevice::operator= ( const audioToFileDevice )
delete

◆ renderSound()

bool audioToFileDevice::renderSound ( const yarp::sig::Sound sound)
overridevirtual

Render a sound using a device (i.e.

send it to the speakers).

Parameters
soundthe sound to be rendered
Returns
true/false upon success/failure

Reimplemented from yarp::dev::AudioPlayerDeviceBase.

Definition at line 142 of file audioToFileDevice.cpp.

◆ setHWGain()

bool audioToFileDevice::setHWGain ( double  gain)
overridevirtual

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

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

Implements yarp::dev::IAudioRender.

Definition at line 152 of file audioToFileDevice.cpp.

◆ startPlayback()

bool audioToFileDevice::startPlayback ( )
overridevirtual

Start the playback.

Returns
true/false upon success/failure

Reimplemented from yarp::dev::AudioPlayerDeviceBase.

Definition at line 118 of file audioToFileDevice.cpp.

◆ stopPlayback()

bool audioToFileDevice::stopPlayback ( )
overridevirtual

Stop the playback.

Returns
true/false upon success/failure

Reimplemented from yarp::dev::AudioPlayerDeviceBase.

Definition at line 130 of file audioToFileDevice.cpp.

◆ waitUntilPlaybackStreamIsComplete()

void audioToFileDevice::waitUntilPlaybackStreamIsComplete ( )
overridevirtual

Reimplemented from yarp::dev::AudioPlayerDeviceBase.

Definition at line 175 of file audioToFileDevice.cpp.


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