With AF3, client applications may choose to use their own preferred datatype when communicating with an audio server (See app note #1). They do not need to use the datatype native to an audio device. Therefore, it is only necessary to choose the audio device based on its sampling rate and number of channels.
Client applications can determine the audio device attributes by looking in the AAudioDeviceDescriptor data structure.
#include <AF/AFlib.h> int FindDefaultDevice(AFAudioConn *aud) { AFDeviceDescriptor *aDev; int i; for(i=0; i<ANumberOfAudioDevices(aud); i++) { aDev = AAudioDeviceDescriptor(aud, i); if ((aDev->inputsFromPhone == 0) && (aDev->outputsToPhone == 0) && (aDev->playSampleFreq == 8000) && (aDev->playNchannels == 1)) return i; } return -1; }Clearly, there is room for improvement in this simple interface. But the essentials are here for you to customize for your client applications. Given time, a more general version of this interface should be part of the client library.
af-bugs@crl.dec.com