YARP
Yet Another Robot Platform
AudioRecorderWrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef YARP_DEV_AUDIORECORDERWRAPPER_H
20 #define YARP_DEV_AUDIORECORDERWRAPPER_H
21 
22 #include <cstdio>
23 
24 
25 #include <yarp/os/BufferedPort.h>
26 #include <yarp/dev/PolyDriver.h>
30 #include <yarp/os/Time.h>
31 #include <yarp/os/Network.h>
32 #include <yarp/os/PeriodicThread.h>
33 #include <yarp/os/Vocab.h>
34 #include <yarp/os/Bottle.h>
35 #include <yarp/os/Stamp.h>
36 #include <yarp/os/Log.h>
37 
38 
44 {
45 private:
46  yarp::dev::PolyDriver m_driver;
47  yarp::dev::IAudioGrabberSound* m_mic; //The microphone device
48  double m_period;
49  yarp::os::Port m_rpcPort;
50  yarp::os::Port m_streamingPort;
51  yarp::os::Stamp m_stamp;
52  size_t m_min_number_of_samples_over_network;
53  size_t m_max_number_of_samples_over_network;
54  double m_getSound_timeout;
55  bool m_isDeviceOwned;
56 public:
65 
66  ~AudioRecorderWrapper() override;
67 
68  bool open(yarp::os::Searchable& config) override;
69  bool close() override;
70  bool attachAll(const yarp::dev::PolyDriverList &p) override;
71  bool detachAll() override;
72 
74  void detach();
75 
76  bool threadInit() override;
77  void threadRelease() override;
78  void run() override;
79 
80  bool read(yarp::os::ConnectionReader& connection) override;
81 };
82 
83 #endif // YARP_DEV_AUDIORECORDERWRAPPER_H
define control board standard interfaces
bool detachAll() override
Detach the object (you must have first called attach).
AudioRecorderWrapper()
Constructor.
AudioRecorderWrapper(const AudioRecorderWrapper &)=delete
void run() override
Loop function.
AudioRecorderWrapper & operator=(const AudioRecorderWrapper &)=delete
bool close() override
Close the DeviceDriver.
AudioRecorderWrapper & operator=(AudioRecorderWrapper &&)=delete
bool threadInit() override
Initialization method.
bool attachAll(const yarp::dev::PolyDriverList &p) override
Attach to a list of objects.
void threadRelease() override
Release method.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
void attach(yarp::dev::IAudioGrabberSound *igrab)
AudioRecorderWrapper(AudioRecorderWrapper &&)=delete
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
Read a YARP-format sound block from a device.
Interface for an object that can wrap/attach to to another.
A container for a device driver.
Definition: PolyDriver.h:27
An interface for reading from a network connection.
An abstraction for a periodic thread.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:28
A mini-server for network communication.
Definition: Port.h:50
A base class for nested structures that can be searched.
Definition: Searchable.h:69
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:25