16#define _USE_MATH_DEFINES
50 if (!b) {
return false; }
54 if (
m_waveform ==
"sine") { m_waveform_enum = waveform_t::sine; }
55 else if (
m_waveform ==
"sawtooth") { m_waveform_enum = waveform_t::sawtooth; }
56 else if (
m_waveform ==
"square") { m_waveform_enum = waveform_t::square; }
57 else if (
m_waveform ==
"constant") { m_waveform_enum = waveform_t::constant; }
58 else {
yError() <<
"Unsupported value for waveform parameter";
return false; }
90 std::lock_guard<std::mutex> lock(
m_mutex);
96 return ReturnValue::return_code::return_value_error_method_failed;
99bool FakeMicrophone::threadInit()
105void FakeMicrophone::run()
124 if (m_waveform_enum == waveform_t::sine)
132 if (m_counter[i] >= m_max_count[i]) {
137 else if(m_waveform_enum == waveform_t::sawtooth)
145 if (m_counter[i] >= m_max_count[i]) {
150 else if (m_waveform_enum == waveform_t::square)
158 if (m_counter[i] >= m_max_count[i]) {
163 else if (m_waveform_enum == waveform_t::constant)
169 if (m_counter[i] >= m_max_count[i]) {
constexpr double c_DEFAULT_PERIOD
unsigned short int audio_sample_16t
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
yarp::dev::ReturnValue setHWGain(double gain) override
Sets the hardware gain of the grabbing device (if supported by the hardware)
virtual ~FakeMicrophone() override
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool close() override
Close the DeviceDriver.
yarp::dev::CircularAudioBuffer_16t * m_inputBuffer
bool configureRecorderAudioDevice(yarp::os::Searchable &config, std::string device_name)
AudioDeviceDriverSettings m_audiorecorder_cfg
A simple collection of objects that can be described and transmitted in a portable way.
A mini-server for performing network communication in the background.
An abstraction for a periodic thread.
bool setPeriod(double period)
Set the (new) period of the thread.
bool start()
Call this to start the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
A base class for nested structures that can be searched.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
#define yCInfo(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.