YARP
Yet Another Robot Platform

portaudio deprecated: This device driver has been deprecated! Please use PortAudioPlayerDeviceDriver or PortAudioRecorderDeviceDriver More...

#include <portaudio/PortAudioDeviceDriver.h>

+ Inheritance diagram for PortAudioDeviceDriver:

Public Member Functions

 PortAudioDeviceDriver ()
 
virtual ~PortAudioDeviceDriver ()
 
bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver. More...
 
bool open (PortAudioDeviceDriverSettings &config)
 Configures the device. More...
 
bool close () override
 Close the DeviceDriver. More...
 
bool getSound (yarp::sig::Sound &sound, size_t min_number_of_samples, size_t max_number_of_samples, double max_samples_timeout_s) override
 Get a sound from a device. More...
 
bool renderSound (const yarp::sig::Sound &sound) override
 Render a sound using a device (i.e. More...
 
bool startRecording () override
 Start the recording. More...
 
bool stopRecording () override
 Stop the recording. More...
 
bool startPlayback () override
 Start the playback. More...
 
bool stopPlayback () override
 Stop the playback. More...
 
bool isPlaying (bool &playback_enabled) override
 Check if the playback has been enabled (e.g. More...
 
bool isRecording (bool &recording_enabled) override
 Check if the recording has been enabled (e.g. More...
 
bool abortSound ()
 
bool immediateSound (const yarp::sig::Sound &sound)
 
bool appendSound (const yarp::sig::Sound &sound)
 
bool getPlaybackAudioBufferMaxSize (yarp::dev::AudioBufferSize &size) override
 
bool getPlaybackAudioBufferCurrentSize (yarp::dev::AudioBufferSize &size) override
 
bool resetPlaybackAudioBuffer () override
 
bool getRecordingAudioBufferMaxSize (yarp::dev::AudioBufferSize &size) override
 
bool getRecordingAudioBufferCurrentSize (yarp::dev::AudioBufferSize &size) override
 
bool resetRecordingAudioBuffer () override
 
bool setHWGain (double gain) override
 Sets the hardware gain of the grabbing device (if supported by the hardware) More...
 
bool setSWGain (double gain) override
 Sets a software gain for the grabbed audio. More...
 
- Public Member Functions inherited from yarp::dev::IAudioGrabberSound
virtual ~IAudioGrabberSound ()
 Destructor. More...
 
virtual bool getSound (yarp::sig::Sound &sound, size_t min_number_of_samples, size_t max_number_of_samples, double max_samples_timeout_s)=0
 Get a sound from a device. More...
 
virtual bool startRecording ()=0
 Start the recording. More...
 
virtual bool stopRecording ()=0
 Stop the recording. More...
 
virtual bool isRecording (bool &recording_enabled)=0
 Check if the recording has been enabled (e.g. More...
 
virtual bool getRecordingAudioBufferMaxSize (yarp::dev::AudioBufferSize &size)=0
 
virtual bool getRecordingAudioBufferCurrentSize (yarp::dev::AudioBufferSize &size)=0
 
virtual bool resetRecordingAudioBuffer ()=0
 
virtual bool setSWGain (double gain)=0
 Sets a software gain for the grabbed audio. More...
 
virtual bool setHWGain (double gain)=0
 Sets the hardware gain of the grabbing device (if supported by the hardware) More...
 
- Public Member Functions inherited from yarp::dev::IAudioRender
virtual ~IAudioRender ()
 Destructor. More...
 
virtual bool renderSound (const yarp::sig::Sound &sound)=0
 Render a sound using a device (i.e. More...
 
virtual bool startPlayback ()=0
 Start the playback. More...
 
virtual bool stopPlayback ()=0
 Stop the playback. More...
 
virtual bool isPlaying (bool &playback_enabled)=0
 Check if the playback has been enabled (e.g. More...
 
virtual bool getPlaybackAudioBufferMaxSize (yarp::dev::AudioBufferSize &size)=0
 
virtual bool getPlaybackAudioBufferCurrentSize (yarp::dev::AudioBufferSize &size)=0
 
virtual bool resetPlaybackAudioBuffer ()=0
 
virtual bool setSWGain (double gain)=0
 Sets a software gain for the played audio. More...
 
virtual bool setHWGain (double gain)=0
 Sets the hardware gain of the playback device (if supported by the hardware) More...
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
 DeviceDriver ()
 
 DeviceDriver (const DeviceDriver &other)=delete
 
 DeviceDriver (DeviceDriver &&other) noexcept=delete
 
DeviceDriveroperator= (const DeviceDriver &other)=delete
 
DeviceDriveroperator= (DeviceDriver &&other) noexcept=delete
 
 ~DeviceDriver () override
 
bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver. More...
 
bool close () override
 Close the DeviceDriver. More...
 
virtual std::string id () const
 Return the id assigned to the PolyDriver. More...
 
virtual void setId (const std::string &id)
 Set the id for this device. More...
 
template<class T >
bool view (T *&x)
 Get an interface to the device driver. More...
 
virtual DeviceDrivergetImplementation ()
 Some drivers are bureaucrats, pointing at others. More...
 
- Public Member Functions inherited from yarp::os::IConfig
virtual ~IConfig ()
 Destructor. More...
 
virtual bool open (Searchable &config)
 Initialize the object. More...
 
virtual bool close ()
 Shut the object down. More...
 
virtual bool configure (Searchable &config)
 Change online parameters. More...
 

Protected Types

enum  {
  RENDER_APPEND =0 ,
  RENDER_IMMEDIATE =1
}
 

Protected Member Functions

void handleError ()
 

Protected Attributes

void * m_system_resource
 
size_t m_numPlaybackChannels
 
size_t m_numRecordChannels
 
int m_frequency
 
bool m_loopBack
 
bool m_getSoundIsNotBlocking
 
PortAudioDeviceDriverSettings m_driverConfig
 
enum PortAudioDeviceDriver:: { ... }  renderMode
 

Detailed Description

portaudio deprecated: This device driver has been deprecated! Please use PortAudioPlayerDeviceDriver or PortAudioRecorderDeviceDriver

Requires the PortAudio library (http://www.portaudio.com), at least v19.

Definition at line 60 of file PortAudioDeviceDriver.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
RENDER_APPEND 
RENDER_IMMEDIATE 

Definition at line 137 of file PortAudioDeviceDriver.h.

Constructor & Destructor Documentation

◆ PortAudioDeviceDriver()

PortAudioDeviceDriver::PortAudioDeviceDriver ( )

Definition at line 190 of file PortAudioDeviceDriver.cpp.

◆ ~PortAudioDeviceDriver()

PortAudioDeviceDriver::~PortAudioDeviceDriver ( )
virtual

Definition at line 208 of file PortAudioDeviceDriver.cpp.

Member Function Documentation

◆ abortSound()

bool PortAudioDeviceDriver::abortSound ( )

Definition at line 464 of file PortAudioDeviceDriver.cpp.

◆ appendSound()

bool PortAudioDeviceDriver::appendSound ( const yarp::sig::Sound sound)

Definition at line 605 of file PortAudioDeviceDriver.cpp.

◆ close()

bool PortAudioDeviceDriver::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 367 of file PortAudioDeviceDriver.cpp.

◆ getPlaybackAudioBufferCurrentSize()

bool PortAudioDeviceDriver::getPlaybackAudioBufferCurrentSize ( yarp::dev::AudioBufferSize size)
overridevirtual

Implements yarp::dev::IAudioRender.

Definition at line 621 of file PortAudioDeviceDriver.cpp.

◆ getPlaybackAudioBufferMaxSize()

bool PortAudioDeviceDriver::getPlaybackAudioBufferMaxSize ( yarp::dev::AudioBufferSize size)
overridevirtual

Implements yarp::dev::IAudioRender.

Definition at line 627 of file PortAudioDeviceDriver.cpp.

◆ getRecordingAudioBufferCurrentSize()

bool PortAudioDeviceDriver::getRecordingAudioBufferCurrentSize ( yarp::dev::AudioBufferSize size)
overridevirtual

Implements yarp::dev::IAudioGrabberSound.

Definition at line 639 of file PortAudioDeviceDriver.cpp.

◆ getRecordingAudioBufferMaxSize()

bool PortAudioDeviceDriver::getRecordingAudioBufferMaxSize ( yarp::dev::AudioBufferSize size)
overridevirtual

Implements yarp::dev::IAudioGrabberSound.

Definition at line 645 of file PortAudioDeviceDriver.cpp.

◆ getSound()

bool PortAudioDeviceDriver::getSound ( yarp::sig::Sound sound,
size_t  min_number_of_samples,
size_t  max_number_of_samples,
double  max_samples_timeout_s 
)
overridevirtual

Get a sound from a device.

Examples: getSound(s, 0, 100, 0.1); returns a sound whose size can vary between 0 and 100, with a maximum blocking time of 0.1 getSound(s, 100, 100, 0.0); returns a sound with exact size of 100. It may block forever (more specifically, until sound size is at least 100). getSound(s, 100, 100000, 0.0); returns a sound with a minimum size of 0, while trying to transfer all the internal buffer. It may block forever (more specifically, until sound size is at least 100).

Parameters
soundthe sound to be filled
min_number_of_samples.The function will block until the driver is able to collect at least min_number_of_samples. If set to zero, the function may return empty sounds.
max_number_of_samples.The function will block until the driver is either able to collect max_number_of_samples or the timeout expires.
max_samples_timeout_s.The timeout (in seconds) to retrieve max_number_of_samples.
Returns
true upon success, false for an invalid set of parameters, such as max_number_of_samples<min_number_of_samples, etc.

Implements yarp::dev::IAudioGrabberSound.

Definition at line 411 of file PortAudioDeviceDriver.cpp.

◆ handleError()

void PortAudioDeviceDriver::handleError ( )
protected

Definition at line 354 of file PortAudioDeviceDriver.cpp.

◆ immediateSound()

bool PortAudioDeviceDriver::immediateSound ( const yarp::sig::Sound sound)

Definition at line 550 of file PortAudioDeviceDriver.cpp.

◆ isPlaying()

bool PortAudioDeviceDriver::isPlaying ( bool &  playback_enabled)
overridevirtual

Check if the playback has been enabled (e.g.

via startPlayback()/stopPlayback())

Parameters
playback_enabledthe status of the device
Returns
true/false upon success/failure

Implements yarp::dev::IAudioRender.

Definition at line 681 of file PortAudioDeviceDriver.cpp.

◆ isRecording()

bool PortAudioDeviceDriver::isRecording ( bool &  recording_enabled)
overridevirtual

Check if the recording has been enabled (e.g.

via startRecording()/stopRecording())

Parameters
recording_enabledthe status of the device
Returns
true/false upon success/failure

Implements yarp::dev::IAudioGrabberSound.

Definition at line 687 of file PortAudioDeviceDriver.cpp.

◆ open() [1/2]

bool PortAudioDeviceDriver::open ( PortAudioDeviceDriverSettings config)

Configures the device.

rate: Sample rate to use, in Hertz. Specify 0 to use a default.

samples: Number of samples per call to getSound. Specify 0 to use a default.

channels: Number of channels of input. Specify 0 to use a default.

read: Should allow reading

write: Should allow writing

Returns
true on success

Definition at line 247 of file PortAudioDeviceDriver.cpp.

◆ open() [2/2]

bool PortAudioDeviceDriver::open ( yarp::os::Searchable config)
overridevirtual

Open the DeviceDriver.

Parameters
configis a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 214 of file PortAudioDeviceDriver.cpp.

◆ renderSound()

bool PortAudioDeviceDriver::renderSound ( const yarp::sig::Sound sound)
overridevirtual

Render a sound using a device (i.e.

send it to the speakers).

Parameters
soundthe sound to be rendered
Returns
true/false upon success/failure

Implements yarp::dev::IAudioRender.

Definition at line 568 of file PortAudioDeviceDriver.cpp.

◆ resetPlaybackAudioBuffer()

bool PortAudioDeviceDriver::resetPlaybackAudioBuffer ( )
overridevirtual

Implements yarp::dev::IAudioRender.

Definition at line 633 of file PortAudioDeviceDriver.cpp.

◆ resetRecordingAudioBuffer()

bool PortAudioDeviceDriver::resetRecordingAudioBuffer ( )
overridevirtual

Implements yarp::dev::IAudioGrabberSound.

Definition at line 651 of file PortAudioDeviceDriver.cpp.

◆ setHWGain()

bool PortAudioDeviceDriver::setHWGain ( double  gain)
overridevirtual

Sets the hardware gain of the grabbing device (if supported by the hardware)

Parameters
gainthe audio gain (1.0 is the default value)
Returns
true/false upon success/failure

Implements yarp::dev::IAudioGrabberSound.

Definition at line 675 of file PortAudioDeviceDriver.cpp.

◆ setSWGain()

bool PortAudioDeviceDriver::setSWGain ( double  gain)
overridevirtual

Sets a software gain for the grabbed audio.

Parameters
gainthe audio gain (1.0 is the default value)
Returns
true/false upon success/failure

Implements yarp::dev::IAudioGrabberSound.

Definition at line 669 of file PortAudioDeviceDriver.cpp.

◆ startPlayback()

bool PortAudioDeviceDriver::startPlayback ( )
overridevirtual

Start the playback.

Returns
true/false upon success/failure

Implements yarp::dev::IAudioRender.

Definition at line 657 of file PortAudioDeviceDriver.cpp.

◆ startRecording()

bool PortAudioDeviceDriver::startRecording ( )
overridevirtual

Start the recording.

Returns
true/false upon success/failure

Implements yarp::dev::IAudioGrabberSound.

Definition at line 395 of file PortAudioDeviceDriver.cpp.

◆ stopPlayback()

bool PortAudioDeviceDriver::stopPlayback ( )
overridevirtual

Stop the playback.

Returns
true/false upon success/failure

Implements yarp::dev::IAudioRender.

Definition at line 663 of file PortAudioDeviceDriver.cpp.

◆ stopRecording()

bool PortAudioDeviceDriver::stopRecording ( )
overridevirtual

Stop the recording.

Returns
true/false upon success/failure

Implements yarp::dev::IAudioGrabberSound.

Definition at line 403 of file PortAudioDeviceDriver.cpp.

Member Data Documentation

◆ m_driverConfig

PortAudioDeviceDriverSettings PortAudioDeviceDriver::m_driverConfig
protected

Definition at line 136 of file PortAudioDeviceDriver.h.

◆ m_frequency

int PortAudioDeviceDriver::m_frequency
protected

Definition at line 132 of file PortAudioDeviceDriver.h.

◆ m_getSoundIsNotBlocking

bool PortAudioDeviceDriver::m_getSoundIsNotBlocking
protected

Definition at line 134 of file PortAudioDeviceDriver.h.

◆ m_loopBack

bool PortAudioDeviceDriver::m_loopBack
protected

Definition at line 133 of file PortAudioDeviceDriver.h.

◆ m_numPlaybackChannels

size_t PortAudioDeviceDriver::m_numPlaybackChannels
protected

Definition at line 130 of file PortAudioDeviceDriver.h.

◆ m_numRecordChannels

size_t PortAudioDeviceDriver::m_numRecordChannels
protected

Definition at line 131 of file PortAudioDeviceDriver.h.

◆ m_system_resource

void* PortAudioDeviceDriver::m_system_resource
protected

Definition at line 129 of file PortAudioDeviceDriver.h.

◆ 

enum { ... } PortAudioDeviceDriver::renderMode

The documentation for this class was generated from the following files: