| OSSAUDIO(3) | Library Functions Manual | OSSAUDIO(3) |
ossaudio — Open
Sound System emulation
OSS Audio Emulation Library (libossaudio, -lossaudio)
#include
<soundcard.h>
The ossaudio library provides an emulation
of the Open Sound System audio interface.
Use the native audio(4) and mixer(4) interfaces for new programs, and this emulation library only for building code written for other operating systems.
The following table summarizes the mappings from native interface device names to OSSv3 mixer controls.
| Native Device Name | OSS Mixer Control |
| *.mic | SOUND_MIXER_MIC |
| *.line | SOUND_MIXER_LINE |
| *.cd | SOUND_MIXER_CD |
| *.dac | SOUND_MIXER_PCM |
| *.aux | SOUND_MIXER_LINE1 |
| *.record | SOUND_MIXER_IMIX |
| *.master | SOUND_MIXER_VOLUME |
| *.treble | SOUND_MIXER_TREBLE |
| *.bass | SOUND_MIXER_BASS |
| *.speaker | SOUND_MIXER_SPEAKER |
| *.output | SOUND_MIXER_OGAIN |
| *.input | SOUND_MIXER_IGAIN |
| *.fmsynth | SOUND_MIXER_SYNTH |
| *.midi | SOUND_MIXER_SYNTH |
The ossaudio interface aims to be
compatible with the Open Sound System version 4, as described in:
4Front Technologies, OSS 4.x Programmer's Guide, http://manuals.opensound.com/developer/, 2007.
The ossaudio library first appeared in
NetBSD 1.3.
The Open Sound System up to version 3 was originally the preferred API for writing audio code under Linux until ALSA became the new default in Linux 2.6. It remains the preferred API in FreeBSD and Solaris, and a large body of code exists supporting it.
AUDIO_MIXER_SET
control types cannot be accurately represented in the OSSv4 mixer API, so
are treated as enums.SNDCTL_DSP_SETPLAYVOL) is
not currently implemented as in OSSv4, and will instead modify the global
volume. Applications need to provide samples with the appropriate
gain.ioctl(), there are other
differences as well. E.g., on a write that would block in non-blocking
mode Linux returns EINTR whereas
NetBSD 1.3 returns
EAGAIN.ioctl() so some
obscure programs can fail to compile.| October 20, 2020 | NetBSD 11.0 |