The core of CLAM audio input/output is the AudioManager class. The AudioManager takes care of all administrative tasks concerning the creation and initialization of audio input and output streams, using the internal, system dependent AudioDevice class.
The first thing you need to do in order to use audio is create an AudioManager object. While this object is present all subsequent audio I/O objects created will use it. You should specify samplerate and latency. The latency is used to control the internal buffersize, and depends on your hardware. Typically, you will be safe with a value of 1024, but especially with a low-latency patched linux you could safely use 256.
The AudioIn and AudioOut classes
The actual audio I/O classes, called AudioIn and AudioOut, can than be uses to create processing endpoints to retrieve audio from, or write audio to. Note that each of these objects is mono (the argument to the Do(..) function is a single Audio object). The AudioIn and AudioOut objects have to be created with an AudioIOConfig object that can be used to specify the device, the channel and the sample rate to use.
Specifying the device
The device is referred to with a string that has the following form:
Currently, implemented architectures are alsa, rtaudio, portaudio and directx. The available devices depend on your hardware and system configuration, and which objects you link your application with (in src/Tools/AudioIO/.... You can use the class AudioDeviceList, to obtain a list of available devices for the platform you use:
This returns a const std::vector<std::string>&
However, if you don't specify the device, or use the string "default:default", the AudioManager will choose the device that seems most adequate for your architecture. Similar, it is possible to obtain a list for the default architecture, passing "default" to the AudioDeviceList::FindList method.
Specifying the channel
In order to have a flexible multi channel system, you can specify the channel you want to use for each AudioIn and AudioOut. The AudioManager will use this information to initialize the internal audio handling. Typically, you may want to use 0 for left and 1 for right.
AudioIn inL(inCfgL); AudioIn inR(inCfgR);
If you want mono input/output, you can simply leave this out, and just create a single default AudioIn/AudioOut object.