SPEAKER(7) —
NAME
/dev/bell − speaker driver /dev/sound − speaker driver
DESCRIPTION
The speaker driver provides a low-level interface to the built-in speaker. To use the speaker, a user program must first open (with the open(2) system call) /dev/sound or /dev/bell. The speaker is an exclusive use device, therefore, only one process can open the speaker at the one time. Once the speaker is opened successfully by one process, any further attempt to open the speaker results in a failure with EBUSY set in errno. Once the speaker is open, the user program accesses the speaker via the write(2) system call. The write system call to the speaker deals with the following structure, defined in <sys/machine/soundreg.h>:
structsound {
intsn_vol;
intsn_dur;
intsn_freq;
};
Every write must be of exactly sizeof(struct sound) bytes. An error is returned from the write system call with EINVAL set in errno if this count is not correct. The write system call specifies the values of these fields. Sn_vol specifies the volume, and takes on an integer value 0, 1, or 2, with 2 being the loudest. Sn_dur specifies the duration in milli-seconds. Finally, sn_freq specifies the frequency in HZ. As usual, an error is returned with EFAULT set in errno if the user program specifies an illegal address.
September 02, 1992