Open Sound System |
Do you have problems with sound/audio application development? Don't panic! Click here for help! |
In general there are two kind of audio devices. The normal type is analog whic means that the device itself is connected to the outside world and performs the necessary analog and digital conversions.
The other type is digital. This means that the device doesn't need to do digital to analog or analog to digital conversions itself. Instead the audio signals are sent unmodified over some kind of digital communication link. One example of this is the optical or RCA/coaxial/cinc S/PDIF interface used in many sound cards and home stereo systems. The benefit is that there is no loss of sound quality when audio data is transferred between devices (some popular sound cards manage to do this too but that's another story).
In most applications it simply doesn't matter if the communication is digital or analog. So there is no need to check this. In addition most drivers don't report this information.
PCM_CAP_ADMASK
is a 4 bit field that consists of the following capability bits.
Cap | Meaning |
PCM_CAP_ANALOGIN | The device has analog input. |
PCM_CAP_ANALOGOUT | The device has analog output. |
PCM_CAP_DIGITALIN | The device has digital input. |
PCM_CAP_DIGITALOUT | The device has digital output. |
If none of the bits are set then it means that the device doesn't report this information. It may have analog or digital inputs and outputs or both of them. The application using this infoamation must understand this instead of thinking that the device doesn't have any inputs or outputs at all. PCM_CAP_ADMASK can be used as a mask if checking for each of these four capabilities at the same time.
If PCM_CAP_DIGITALIN or PCM_CAP_DIGITALOUT bits were reported then it's possible to use some OSS API extensions such as Digital audio interface status and setup with this device.
Audio device capabilities like PCM_CAP_ADMASK can be checked using the SNDCTL_AUDIOINFO or SNDCTL_DSP_GETCAPS ioctl calls.