21#define AUTOMATIC_REC_START 0
22#define DEBUG_TIME_SPENT 0
25#define DEFAULT_SAMPLE_RATE (44100)
26#define DEFAULT_NUM_CHANNELS (2)
27#define DEFAULT_SAMPLE_SIZE (2)
33 #if AUTOMATIC_REC_START
56 if (max_number_of_samples < min_number_of_samples)
74 if (
buff_size >= max_number_of_samples) {
break; }
106 if (s > (std::numeric_limits<int16_t>::max() -
m_cliptol) ||
107 s < (std::numeric_limits<int16_t>::min() +
m_cliptol))
153 std::lock_guard<std::mutex> lock(
m_mutex);
170 std::lock_guard<std::mutex> lock(
m_mutex);
178 std::lock_guard<std::mutex> lock(
m_mutex);
190 std::lock_guard<std::mutex> lock(
m_mutex);
222 m_audiorecorder_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();
#define DEFAULT_NUM_CHANNELS
#define DEFAULT_SAMPLE_RATE
constexpr double c_sleep_time
const yarp::os::LogComponent & AUDIORECORDER_BASE()
constexpr double c_sleep_time
yarp::dev::CircularAudioBuffer_16t * m_inputBuffer
virtual yarp::dev::ReturnValue resetRecordingAudioBuffer() override
virtual yarp::dev::ReturnValue getRecordingAudioBufferCurrentSize(yarp::sig::AudioBufferSize &size) override
virtual ~AudioRecorderDeviceBase()
virtual yarp::dev::ReturnValue getRecordingAudioBufferMaxSize(yarp::sig::AudioBufferSize &size) override
virtual yarp::dev::ReturnValue startRecording() override
Start the recording.
virtual yarp::dev::ReturnValue setSWGain(double gain) override
Sets a software gain for the grabbed audio.
virtual yarp::dev::ReturnValue stopRecording() override
Stop the recording.
virtual yarp::dev::ReturnValue 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.
bool configureRecorderAudioDevice(yarp::os::Searchable &config, std::string device_name)
bool m_enable_buffer_autoclear
AudioDeviceDriverSettings m_audiorecorder_cfg
virtual yarp::dev::ReturnValue isRecording(bool &recording_enabled) override
Check if the recording has been enabled (e.g.
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.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
static void delaySystem(double seconds)
A single value (typically within a Bottle).
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
void setFrequency(int freq)
Set the frequency of the sound (i.e.
std::vector< std::reference_wrapper< audio_sample > > getInterleavedAudioRawData() const
Returns a serialized version of the sound, in interleaved format, e.g.
size_t getChannels() const
Get the number of channels of the sound.
void amplify(double gain)
amplify a sound
void resize(size_t samples, size_t channels=1)
Set the sound size.
void set(audio_sample value, size_t sample, size_t channel=0)
size_t getSamples() const
Get the number of samples contained in the sound.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
#define yCWarningThrottle(component, period,...)
For streams capable of holding different kinds of content, check what they actually have.
yarp::dev::CircularAudioBuffer< unsigned short int > CircularAudioBuffer_16t
double now()
Return the current time in seconds, relative to an arbitrary starting point.
An interface to the operating system, including Port based communication.