YARP
Yet Another Robot Platform
Example for portaudio (portaudio_basic)

Instantiates portaudio device implemented by PortAudioDeviceDriver. More...

+ Collaboration diagram for Example for portaudio (portaudio_basic):

Instantiates portaudio device implemented by PortAudioDeviceDriver.

# start up a device for listening from a microphone
device portaudio
read
allow-deprecated-devices

If this text is saved in a file called portaudio_basic.ini then the device can be created by doing:

yarpdev --file portaudio_basic.ini

Of course, the configuration could be passed just as command line options, or as a yarp::os::Property object in a program:

Property p;
p.fromConfigFile("portaudio_basic.ini");
// of course you could construct the Property object on-the-fly
PolyDriver dev;
dev.open(p);
if (dev.isValid()) { /* use the device via view method */ }

Here is a list of properties checked when starting up a device based on this configuration file. Note that which properties are checked can depend on whether other properties are present. In some cases properties can also vary between operating systems. So this is just an example

PROPERTYDESCRIPTIONDEFAULT
device
rateaudio sample rate (0=automatic)0
samplesnumber of samples per network packet (0=automatic). For chunks of 1 second of recording set samples=rate. Channels number is handled internally.0
channelsnumber of audio channels (0=automatic, max is 2)0
readif present, just deal with reading audio (microphone)
writeif present, just deal with writing audio (speaker)
idwhich portaudio index to use (-1=automatic)-1
loopbackif present, send audio read from microphone immediately back to speaker
render_mode_append
render_mode_immediate
allow-deprecated-devices
See also
PortAudioDeviceDriver