6#define _USE_MATH_DEFINES
24#define DEBUG_TIME_SPENT 0
27#define DEFAULT_SAMPLE_RATE (44100)
28#define DEFAULT_NUM_CHANNELS (2)
29#define DEFAULT_SAMPLE_SIZE (2)
35 yCError(
AUDIOPLAYER_BASE) <<
"getPlaybackAudioBufferCurrentSize() called, but no audio buffer is allocated yet";
66 std::lock_guard<std::recursive_mutex> lock(
m_mutex);
78 std::lock_guard<std::recursive_mutex> lock(
m_mutex);
88 std::lock_guard<std::recursive_mutex> lock(
m_mutex);
109 std::lock_guard<std::recursive_mutex> lock(
m_mutex);
149 std::lock_guard<std::recursive_mutex> lock(
m_mutex);
172 chans !=
this->m_audioplayer_cfg.numChannels)
180 chans <<
"channels, " <<
freq <<
" Hz";
222 m_audioplayer_cfg.
numSamples = config.
check(
"samples",
Value(0),
"number of samples per network packet (0=automatic). For chunks of 1 second of recording set samples=rate. Channels number is handled internally.").asInt32();
237 if (config.
check(
"render_mode_append"))
241 if (config.
check(
"render_mode_immediate"))
273 yCError(
AUDIOPLAYER_BASE) <<
"waitUntilPlaybackStreamIsComplete() called, but no audio buffer is allocated yet";
const yarp::os::LogComponent & AUDIOPLAYER_BASE()
#define DEFAULT_NUM_CHANNELS
#define DEFAULT_SAMPLE_RATE
constexpr double c_sleep_time
virtual yarp::dev::ReturnValue getPlaybackAudioBufferMaxSize(yarp::sig::AudioBufferSize &size) override
virtual bool immediateSound(const yarp::sig::Sound &sound)
virtual bool configureDeviceAndStart()=0
bool m_enable_buffer_autoclear
virtual yarp::dev::ReturnValue renderSound(const yarp::sig::Sound &sound) override
Render a sound using a device (i.e.
virtual yarp::dev::ReturnValue stopPlayback() override
Stop the playback.
virtual yarp::dev::ReturnValue getPlaybackAudioBufferCurrentSize(yarp::sig::AudioBufferSize &size) override
virtual yarp::dev::ReturnValue isPlaying(bool &playback_enabled) override
Check if the playback has been enabled (e.g.
std::recursive_mutex m_mutex
virtual void waitUntilPlaybackStreamIsComplete()
virtual ~AudioPlayerDeviceBase()
virtual yarp::dev::ReturnValue resetPlaybackAudioBuffer() override
virtual bool appendSound(const yarp::sig::Sound &sound)
enum yarp::dev::AudioPlayerDeviceBase::@87 m_renderMode
yarp::dev::CircularAudioBuffer_16t * m_outputBuffer
virtual yarp::dev::ReturnValue setSWGain(double gain) override
Sets a software gain for the played audio.
bool configurePlayerAudioDevice(yarp::os::Searchable &config, std::string device_name)
virtual bool interruptDeviceAndClose()=0
virtual yarp::dev::ReturnValue startPlayback() override
Start the playback.
AudioDeviceDriverSettings m_audioplayer_cfg
yarp::sig::AudioBufferSize size()
yarp::sig::AudioBufferSize getMaxSize()
@ return_value_error_not_ready
Method failed due to invalid internal status/invalid request.
@ return_value_error_method_failed
Method is deprecated.
A mini-server for performing network communication in the background.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
A single value (typically within a Bottle).
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
size_t getChannels() const
Get the number of channels of the sound.
int getFrequency() const
Get the frequency of the sound (i.e.
audio_sample get(size_t sample, size_t channel=0) const
size_t getSamples() const
Get the number of samples contained in the sound.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
yarp::dev::CircularAudioBuffer< unsigned short int > CircularAudioBuffer_16t
void delay(double seconds)
Wait for a certain number of seconds.
An interface to the operating system, including Port based communication.