YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
PortAudioPlayerDeviceDriver.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#ifndef PortAudioPlayerDeviceDriverh
7#define PortAudioPlayerDeviceDriverh
8
10#include <yarp/os/Thread.h>
11
15#include <portaudio.h>
16#include <mutex>
17
19
36 public yarp::os::Thread,
38{
39private:
40 PaStreamParameters m_outputParameters;
41 PaStream* m_stream;
42 PaError m_err;
43
44public:
51
52private:
53 bool abortSound();
54 bool configureDeviceAndStart() override;
55
56public: //DeviceDriver
57 bool open(yarp::os::Searchable& config) override;
58 bool close() override;
59
60public: //AudioRecorderDeviceBase(IAudioGrabberSound)
62 yarp::dev::ReturnValue setHWGain(double gain) override;
65
66 bool interruptDeviceAndClose() override;
67
68public: //Thread
69 void threadRelease() override;
70 bool threadInit() override;
71 void run() override;
72
73protected:
75
76 void handleError();
77};
78
79#endif
This class is the parameters parser for class PortAudioPlayerDeviceDriver.
portaudioPlayer: A device driver for an audio playback device wrapped by PortAudio library.
yarp::dev::ReturnValue setHWGain(double gain) override
Sets the hardware gain of the playback device (if supported by the hardware)
bool threadInit() override
Initialization method.
yarp::dev::ReturnValue stopPlayback() override
Stop the playback.
PortAudioPlayerDeviceDriver(PortAudioPlayerDeviceDriver &&)=delete
PortAudioPlayerDeviceDriver & operator=(PortAudioPlayerDeviceDriver &&)=delete
void run() override
Main body of the new thread.
yarp::dev::ReturnValue startPlayback() override
Start the playback.
PortAudioPlayerDeviceDriver(const PortAudioPlayerDeviceDriver &)=delete
PortAudioPlayerDeviceDriver & operator=(const PortAudioPlayerDeviceDriver &)=delete
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
void threadRelease() override
Release method.
AudioPlayerDeviceBase : a base class for all audio player devices
Interface implemented by all device drivers.
A base class for nested structures that can be searched.
Definition Searchable.h:31
An abstraction for a thread of execution.
Definition Thread.h:21