== Audio == The CX2388x audio stream (Function 1) provides 48KHz, 16-bit stereo PCM audio from an analog TV or FM radio frontend, or from an external audio decoder via an I^2^S-compliant digital interface. The ioctl(2) interface for the cx88audio driver is defined in /usr/local/include/cx88/cx88_audio_ioctl.h, and is similiar to the interfaces for the [[Overview/TransportStream|MPEG TS]] and [[Overview/RawVideo|Raw Video]] drivers. The CX88_AUDIO_FORMAT ioctl is used to specify the broadcast format and/or input source of the audio data, but it does not need to be issued before the audio buffers are configured. If the CX88_AUDIO_FORMAT ioctl is not issued, the driver will default to using an FM radio format with an analog broadcast source. === OSS Interface === In addition to providing a "normal" cx88-style configuration/capture interface, the audio driver also integrates with FreeBSD's "pcm" audio driver framework, which allows it to be used as an [[http://www.opensound.com/oss.html|OSS]]-compliant audio input device. For each cx88 audio device, a /dev/dsp* node will be available for use by any OSS-compatible application. In this case, the CX88_AUDIO_FORMAT ioctl is still necessary to configure the source and broadcast format, and the I^2^C configuration ioctls will be necessary to configure any frontend devices, but the buffer configuration and capture ioctls should be omitted, as these functions will be handled through the OSS interface. === Enabling the audio function === Many CX2388x-based cards do not have the audio function enabled, even though they are capable of capture analog audio. Generally, if the video function (PCI function 0) is enabled, then the card will also be capable of capturing audio. This is most often the case with older cards made before the 2006-2007 timeframe. Most of these cards were intended to be used with a patch cable running from the card's audio out jack to your soundcard's line-in jack. The mechanism for supporting this type of audio capture is easier to implement in a driver than full-blown DMA audio support, but it is also ungainly and notoriously bug-ridden, and it sucks up a valuable sound card connector, so I don't support it in my driver. If you have a card without the audio function, you may not be out of luck. PCI functions on the CX2388x can be enabled or disabled by writing a bitmask to the card's onboard EEPROM, provided the card vendor has not write-protected the EEPROM. The source code for a simple application that enables the audio function is provided at /usr/local/share/examples/cx88/cx88_audio_enable.cpp. You can compile it as follows: `g++ -Wall -O2 -I/usr/local/include/cx88 -I/usr/local/include/libtuner -L/usr/local/lib/libtuner -ltuner -o audio_enable cx88_audio_enable.cpp` In order to run it, you must have the cx88video driver loaded and a /dev/cx88video* device node for the card on which you want to enable the audio function. You may then enable the audio function by running `audio_enable /dev/cx88video#`, where # is the device node number of the video driver for your card.