shithub: riscv

ref: 7742661aebb96a26f1cb34a68bcf631065913806
dir: /sys/man/3/audio/

View raw version
.TH AUDIO 3 
.SH NAME
audio \- audio device
.SH SYNOPSIS
.nf
.B bind -a #A /dev
.sp 0.3v
.B /dev/audio
.B /dev/audioctl
.B /dev/audiostat
.B /dev/volume
.fi
.SH DESCRIPTION
The audio device serves a one-level directory,
giving access to the stereo audio ports.
.B Audio
is the data file, which can be written for audio playback.
Audio data is a sequence of stereo samples, left sample first.
Each sample is a 16 bit little-endian two's complement integer;
the default sampling rate is 44.1 kHz.
.PP
The length of the
.B audio
file as returned by
.IR stat (2)
represents the number of bytes buffered for output.
.PP
.B Audioctl
is driver specific control file and left undocumented here.
.PP
.B Audiostat
is a read only status file. The first line has a length of 32 bytes
including the newline and starts with the string
.B bufsize
followed by the preferred write unit (in bytes) and the string
.B buffered
followed by the number of bytes currently queued for output. The
numbers are decimal and right-padded with spaces to fit.
After this fixed header, the content of the file is driver-specific.
.PP
.B Volume
is the control file associated with the audio port.  Each source has
an associated stereo volume control,
ranging from 0 (quiet) to 100 (loud). 
In addition, there are controls for the sampling rate,
latency control and for any tone controls.
Reads
return lines of the form
.IP
.I source
.I left
.I right
.PP
or
.IP
.I source
.I value
.PP
Valid sources depend on the particular audio device,
though all devices have an
.B audio
stereo source, which controls the output volume from the D/A converter.
Values for
.B speed
set the sampling frequency of the audio device and
.B delay
limits the audio data output buffering to a number of samples.
.PP
Writes accept the same format except that for stereo sources 
.I left
and
.I right
can be abbreviated to a single
.I value
if both should be set the same.
.SH SOURCE
.B /sys/src/9/port/devaudio.c
.SH SEE ALSO
.IR nusb (4)