OSSAUDIO(3) | Library Functions Manual | OSSAUDIO(3)

# NAME

`ossaudio` — Open Sound System emulation

# LIBRARY

OSS Audio Emulation Library (libossaudio, -lossaudio)

# SYNOPSIS

`#include <soundcard.h>`

# DESCRIPTION

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.

## Mixer Control Map

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

# COMPATIBILITY

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.

# SEE ALSO

ioctl(2), audio(4), midi(4), mixer(4)

# HISTORY

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.

# BUGS

- The emulation is incomplete. Some less popular features are not emulated (e.g. sync groups), but the essential ioctls used by the majority of software are covered.
- NetBSD `AUDIO_MIXER_SET` control types cannot be accurately represented in the OSSv4 mixer API, so are treated as enums.
- Per-stream volume (i.e. `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.
- Linux, FreeBSD, and Solaris provide /dev/dsp and /dev/mixer devices in place of the /dev/audio and /dev/mixer devices this compatibility layer must be accessed through on NetBSD. However, changing this is typically trivial when porting programs.
- The emulation only covers `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`.
- The emulation uses a #define for `ioctl`() so some obscure programs can fail to compile.

October 20, 2020 | NetBSD 11.0