YARP
Yet Another Robot Platform
PortAudioRecorderDeviceDriver.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 PortAudioRecorderDeviceDriverh
20 #define PortAudioRecorderDeviceDriverh
21 
22 #include <yarp/os/ManagedBytes.h>
23 #include <yarp/os/Thread.h>
24 
25 #include <yarp/dev/DeviceDriver.h>
28 #include <portaudio.h>
29 
50  public yarp::os::Thread
51 {
52 private:
53  PaStreamParameters m_inputParameters;
54  PaStream* m_stream;
55  PaError m_err;
56 
57 public:
64 
65 public: //DeviceDriver
66  bool open(yarp::os::Searchable& config) override;
67  bool close() override;
68 
69 public: //AudioRecorderDeviceBase(IAudioGrabberSound)
70  bool startRecording() override;
71  bool stopRecording() override;
72 
73  public: //Thread
74  void threadRelease() override;
75  bool threadInit() override;
76  void run() override;
77 
78 protected:
81  void handleError();
82 };
83 
84 #endif
PortAudioRecorderDeviceDriver::m_system_resource
void * m_system_resource
Definition: PortAudioRecorderDeviceDriver.h:79
PortAudioRecorderDeviceDriver::PortAudioRecorderDeviceDriver
PortAudioRecorderDeviceDriver(PortAudioRecorderDeviceDriver &&)=delete
PortAudioRecorderDeviceDriver::~PortAudioRecorderDeviceDriver
~PortAudioRecorderDeviceDriver() override
Definition: PortAudioRecorderDeviceDriver.cpp:145
PortAudioRecorderDeviceDriver::startRecording
bool startRecording() override
Start the recording.
Definition: PortAudioRecorderDeviceDriver.cpp:245
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
CircularAudioBuffer.h
yarp::dev::DeviceDriver
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
PortAudioRecorderDeviceDriver::run
void run() override
Main body of the new thread.
Definition: PortAudioRecorderDeviceDriver.cpp:273
yarp::os::Thread
An abstraction for a thread of execution.
Definition: Thread.h:25
yarp::dev::AudioRecorderDeviceBase
Definition: AudioRecorderDeviceBase.h:34
PortAudioRecorderDeviceDriver::operator=
PortAudioRecorderDeviceDriver & operator=(const PortAudioRecorderDeviceDriver &)=delete
PortAudioRecorderDeviceDriver::open
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: PortAudioRecorderDeviceDriver.cpp:151
PortAudioRecorderDeviceDriver::threadRelease
void threadRelease() override
Release method.
Definition: PortAudioRecorderDeviceDriver.cpp:263
ManagedBytes.h
Thread.h
PortAudioRecorderDeviceDriver::stopRecording
bool stopRecording() override
Stop the recording.
Definition: PortAudioRecorderDeviceDriver.cpp:254
PortAudioRecorderDeviceDriver::close
bool close() override
Close the DeviceDriver.
Definition: PortAudioRecorderDeviceDriver.cpp:222
PortAudioRecorderDeviceDriver::threadInit
bool threadInit() override
Initialization method.
Definition: PortAudioRecorderDeviceDriver.cpp:267
PortAudioRecorderDeviceDriver::PortAudioRecorderDeviceDriver
PortAudioRecorderDeviceDriver()
Definition: PortAudioRecorderDeviceDriver.cpp:137
PortAudioRecorderDeviceDriver::operator=
PortAudioRecorderDeviceDriver & operator=(PortAudioRecorderDeviceDriver &&)=delete
PortAudioRecorderDeviceDriver::m_device_id
int m_device_id
Definition: PortAudioRecorderDeviceDriver.h:80
AudioRecorderDeviceBase.h
PortAudioRecorderDeviceDriver::PortAudioRecorderDeviceDriver
PortAudioRecorderDeviceDriver(const PortAudioRecorderDeviceDriver &)=delete
PortAudioRecorderDeviceDriver::handleError
void handleError()
Definition: PortAudioRecorderDeviceDriver.cpp:209
DeviceDriver.h
PortAudioRecorderDeviceDriver
portaudioRecorder: A device driver for an audio source wrapped by PortAudio library.
Definition: PortAudioRecorderDeviceDriver.h:51