Home |
Function USBAudioGetInfo |
Function USBAudioGetInfoUSBAudioGetInfo retrieves information about connected USB Audio devices and functions: #define USB_MAX_FREQUENCIES 8 typedef struct { const RTUDeviceDescriptor * Device; const RTUConfigurationDescriptor * Configuration; const RTUInterfaceDescriptor * AC; const RTUInterfaceDescriptor * AS; const RTUEndpointDescriptor * Endpoint; int Direction; int AudioID; RTUPipeHandle ControlPipe; UINT FormatTag; UINT Channels; UINT BytesPerChannel; UINT nFrequencies; UINT Frequencies[USB_MAX_FREQUENCIES]; } USBAudioInfo; int USBAudioGetInfo(int AudioIndex, USBAudioInfo * Info); ParametersAudioIndexIndex of the Audio function to retrieve. This value should be in range 0..USB_AUDIO_MAX_DEVICES (8) - 1. InfoPointer to a structure to receive information about the specified audio function. This value may be NULL. return valueIf an Audio function is present at the requested index, the function's AudioID is returned. Otherwise, a negative error code is returned. If this function succeeds and parameter Info is not NULL, *Info is filled with information about an Audio function. Note that a single Audio device can implement several Audio functions. Each Audio function is uniquely identified by the AudioID value. When an audio device is disconnected and then a new (possibly different) audio device is reconnected, another Audio function will be available on the same index, but the AudioID value will have changed. Members Device, Configuration, AC, AS, and Endpoint point to standard USB descriptors which describe the device, configuration, interface, and endpoint of this Audio function. AC points to the Audio Control Interface descriptor while AS points to the Audio Stream Interface descriptor. Direction is the I/O direction (RTUInput or RTUOutput) of the endpoint associated with this audio function. If Direction is RTUInput, this Audio function can be used to record sound. If Direction is RTUOutput, this Audio function can be used to play sound. AudioID is identical with the function's return value. ControlPipe is an open pipe to the default endpoint 0 and may be used by the application to communicate with the device. FormatTag specifies the audio data format supported by the stream interface. FormatTag value USB_AUDIO_PCM is used for signed 16 bit integer while USB_AUDIO_PCM8 is used for unsigned byte. Channels specified the number of audio channels of this function (1 for Mono or 2 for Stereo). BytesPerChannel specifies the number of bytes transferred per channel and data sample. This value will be 1 for FormatTag USB_AUDIO_PCM8 and 2 for FormatTag USB_AUDIO_PCM. nFrequencies specified the number of frequencies (sampling rates) supported by the audio function. The supported frequencies are listed in array Frequencies. The currently selected frequency can be queried and changed with functions USBAudioGetFrequency and USBAudioSetFrequency.
|