
SunOS 5.5 Ioctl Requests audio(7I)
structure and output is stopped until additional data is written. If an application
attempts to write a number of bytes that is not a multiple of the current sample frame
size, an error will be generated and the device will need to be closed before any future
writes will succeed.
Asynchronous I/O TheI_SETSIG STREAMS ioctl enables asynchronous notification, through theSIGPOLL
signal, of input and output ready conditions. TheO_NONBLOCK flag may be set using
the F_SETFL fcntl(2) to enable non-blocking read() and write() requests. This is normally
sufficient for applications to maintain an audio stream in the background.
Audio Control
Pseudo-Device
It is sometimes convenient to have an application, such as a volume control panel,
modify certain characteristics of the audio device while it is beingused by an unrelated
process. The /dev/audioctl pseudo-device is provided for this purpose. Anynumber of
processes may open /dev/audioctl simultaneously. However, read() and write() system
calls are ignored by /dev/audioctl. TheAUDIO_GETINFO and AUDIO_SETINFO ioctl
commands may be issued to /dev/audioctl to determine the status or alter the behavior of
/dev/audio. Note: In general, the audio control device name is constructed by appending
the letters"ctl" to the path name of the audio device.
Audio Status Change
Notification
Applications that open the audio control pseudo-device may request asynchronous
notification of changes in the state of the audio device by settingthe S_MSG flag in an
I_SETSIG STREAMS ioctl. Such processes receive aSIGPOLL signal when any of the fol-
lowing events occur:
An AUDIO_SETINFO ioctl has altered the device state.
An input overflow or output underflow has occurred.
An end-of-file record (zero-length buffer) has been processed on output.
An open() or close() of /dev/audio has altered the device state.
An external event (such as speakerbox volume control) has altered the
device state.
IOCTLS
Audio Information
Structure
The state of the audio device may be polled or modified using theAUDIO_GETINFO and
AUDIO_SETINFO ioctl commands. These commands operate on the audio_info struc-
ture as defined, in <sys/audioio.h>, as follows:
/∗ This structure contains state information for audio device
IO streams ∗/
struct audio_prinfo {
/∗ The following values describe the audio data encoding ∗/
uint_t sample_rate; /∗ samples per second ∗/
uint_t channels; /∗ number of interleaved channels ∗/
uint_t precision; /∗ number of bits per sample ∗/
uint_t encoding; /∗ data encoding method ∗/
/∗ The following values control audio device configuration ∗/
uint_t gain; /∗ volume level ∗/
uint_t port; /∗ selected I/O port ∗/
uint_t buffer_size; /∗ I/O buffer size ∗/
/∗ The following values describe the current device state ∗/
modified 21 Mar 1995 7I-27
Comentários a estes Manuais