AudioPlayerDeviceBase
: a base class for all audio player devices
More...
#include <yarp/dev/AudioPlayerDeviceBase.h>
Public Member Functions | |
virtual bool | renderSound (const yarp::sig::Sound &sound) override |
Render a sound using a device (i.e. | |
virtual bool | startPlayback () override |
Start the playback. | |
virtual bool | stopPlayback () override |
Stop the playback. | |
virtual bool | isPlaying (bool &playback_enabled) override |
Check if the playback has been enabled (e.g. | |
virtual bool | getPlaybackAudioBufferMaxSize (yarp::sig::AudioBufferSize &size) override |
virtual bool | getPlaybackAudioBufferCurrentSize (yarp::sig::AudioBufferSize &size) override |
virtual bool | resetPlaybackAudioBuffer () override |
virtual bool | setSWGain (double gain) override |
Sets a software gain for the played audio. | |
virtual | ~AudioPlayerDeviceBase () |
Public Member Functions inherited from yarp::dev::IAudioRender | |
virtual | ~IAudioRender () |
Destructor. | |
virtual bool | setHWGain (double gain)=0 |
Sets the hardware gain of the playback device (if supported by the hardware) | |
Protected Types | |
enum | { RENDER_APPEND = 0 , RENDER_IMMEDIATE = 1 } |
Protected Member Functions | |
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) |
Protected Attributes | |
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 |
AudioPlayerDeviceBase
: a base class for all audio player 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 | render_mode_append | bool | - | true | No | A new sound is appended to the playback buffer and reproduced accordingly | - |
AUDIO_BASE | render_mode_immediate | bool | - | false | No | Every new sound is immediately reproduced, stopping the current playback | - |
AUDIO_BASE | buffer_autoclear | bool | - | false | No | Automatically clear the buffer every time the devices is started/stopped | If false, stop acts like a pause, and start allows to resume the playback |
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 49 of file AudioPlayerDeviceBase.h.
|
protected |
Enumerator | |
---|---|
RENDER_APPEND | |
RENDER_IMMEDIATE |
Definition at line 60 of file AudioPlayerDeviceBase.h.
|
virtual |
Definition at line 55 of file AudioPlayerDeviceBase.cpp.
|
protectedvirtual |
Definition at line 113 of file AudioPlayerDeviceBase.cpp.
|
protectedpure virtual |
Implemented in AudioToFileDevice, and FakeSpeaker.
|
protected |
Definition at line 210 of file AudioPlayerDeviceBase.cpp.
|
overridevirtual |
Implements yarp::dev::IAudioRender.
Definition at line 31 of file AudioPlayerDeviceBase.cpp.
|
overridevirtual |
Implements yarp::dev::IAudioRender.
Definition at line 43 of file AudioPlayerDeviceBase.cpp.
|
protectedvirtual |
Definition at line 128 of file AudioPlayerDeviceBase.cpp.
|
protectedpure virtual |
Implemented in AudioToFileDevice, FakeSpeaker, and PortAudioPlayerDeviceDriver.
Check if the playback has been enabled (e.g.
via startPlayback()/stopPlayback())
playback_enabled | the status of the device |
Implements yarp::dev::IAudioRender.
Definition at line 95 of file AudioPlayerDeviceBase.cpp.
|
overridevirtual |
Render a sound using a device (i.e.
send it to the speakers).
sound | the sound to be rendered |
Implements yarp::dev::IAudioRender.
Reimplemented in AudioToFileDevice.
Definition at line 145 of file AudioPlayerDeviceBase.cpp.
|
overridevirtual |
Implements yarp::dev::IAudioRender.
Definition at line 101 of file AudioPlayerDeviceBase.cpp.
Sets a software gain for the played audio.
gain | the audio gain (1.0 is the default value) |
Implements yarp::dev::IAudioRender.
Definition at line 64 of file AudioPlayerDeviceBase.cpp.
|
overridevirtual |
Start the playback.
Implements yarp::dev::IAudioRender.
Reimplemented in AudioToFileDevice, and PortAudioPlayerDeviceDriver.
Definition at line 75 of file AudioPlayerDeviceBase.cpp.
|
overridevirtual |
Stop the playback.
Implements yarp::dev::IAudioRender.
Reimplemented in AudioToFileDevice, and PortAudioPlayerDeviceDriver.
Definition at line 85 of file AudioPlayerDeviceBase.cpp.
|
protectedvirtual |
Reimplemented in AudioToFileDevice, and PortAudioPlayerDeviceDriver.
Definition at line 260 of file AudioPlayerDeviceBase.cpp.
|
protected |
Definition at line 59 of file AudioPlayerDeviceBase.h.
|
protected |
Definition at line 56 of file AudioPlayerDeviceBase.h.
|
protected |
Definition at line 52 of file AudioPlayerDeviceBase.h.
|
protected |
Definition at line 58 of file AudioPlayerDeviceBase.h.
|
protected |
Definition at line 54 of file AudioPlayerDeviceBase.h.
|
protected |
Definition at line 55 of file AudioPlayerDeviceBase.h.
|
protected |
Definition at line 53 of file AudioPlayerDeviceBase.h.
enum { ... } yarp::dev::AudioPlayerDeviceBase::m_renderMode |
|
protected |
Definition at line 57 of file AudioPlayerDeviceBase.h.