YARP
Yet Another Robot Platform
fakeMicrophone.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
10 #include <yarp/sig/Sound.h>
11 #include <yarp/sig/SoundFile.h>
12 
13 #include <string>
14 #include <mutex>
15 
40 {
41 public:
43  fakeMicrophone(const fakeMicrophone&) = delete;
47  ~fakeMicrophone() override;
48 
49 public:
50  bool setHWGain(double gain) override;
51 
52 public: // DeviceDriver
53  bool open(yarp::os::Searchable &config) override;
54  bool close() override;
55 
56 private:
57  //thread
58  bool threadInit() override;
59  void run() override;
60 
61 private:
62  std::vector<size_t> m_counter;
63  std::vector<size_t> m_max_count;
64  size_t m_wave_amplitude = 32000;
65  double m_sig_freq=440; //Hz
66  size_t m_samples_to_be_copied = 512;
67 
68  enum waveform_t
69  {
70  sine = 0,
71  sawtooth = 1,
72  square = 2,
73  constant = 3
74  } m_waveform = sine;
75 };
fakeMicrophone : fake microphone device implementing the IAudioGrabberSound interface to generate a t...
fakeMicrophone & operator=(const fakeMicrophone &)=delete
bool setHWGain(double gain) override
Sets the hardware gain of the grabbing device (if supported by the hardware)
bool close() override
Close the DeviceDriver.
fakeMicrophone(fakeMicrophone &&)=delete
fakeMicrophone & operator=(fakeMicrophone &&)=delete
fakeMicrophone(const fakeMicrophone &)=delete
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
~fakeMicrophone() override
AudioRecorderDeviceBase : a base class for all audio recorder devices
Interface implemented by all device drivers.
Definition: DeviceDriver.h:35
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
Definition: Searchable.h:66