Google
 

Open Sound System
OSS 4.x Programmer's Guide

Do you have problems with sound/audio application development? Don't panic! Click here for help!

OSS Mixer Programming

The mixer interface of OSS has been rewritten in the 4.0 version. The old "legacy" mixer API is still supported by older drivers. However most future devices will not support it. The original mixer API was designed for some consumer sound cards but it has been inadequate for professional devices. See the OSS legacy mixer interface (obsolete) section for more info about this interface.

The design philosophy of the OSS 4.0 mixer API is that mixer and control panel settings will be handled with dedicated mixer programs (such as ossxmix ) that are shipped with the driver software. However we decided published the new mixer API so that other developers can implement alternative (and hopefully better) mixer programs.

Selecting the recording source and setting rec/play volumes

Audio programs have traditionally used the mixer device to control certain settings of the audio device. With OSS 4.0 the recording source selection as well as playback and recording level control can be handled locally using features of the audio API. Even the mixer may have controls for these purposes they should not be used from audio applications. You can find the descriptions of the following ioctl calls from the Audio Programming section of this manual.

Mixer related ioctl calls

SourceExplanation
SNDCTL_MIX_DESCRIPTIONGet description text for a mixer control
SNDCTL_MIX_ENUMINFOGet choice list for a MIXT_ENUM control
SNDCTL_MIX_EXTINFOGet a mixer extension descriptor.
SNDCTL_MIX_NREXTGet number of mixer extension descriptor records
SNDCTL_MIX_NRMIXGet number of mixer devices in the system
SNDCTL_MIX_READRead the current value of a mixer control
SNDCTL_MIX_WRITEChange value of a mixer control

In addition the SNDCTL_MIXERINFO ioctl call can be used to get general information about a mixer device.

Some sample mixer programs

We have published the source codes for the mixer programs shipped with OSS. You can use the following programs as examples when implementing a new mixer. However please make sure you read this manual very carefully before witing any code.

ProgramDescription
ossxmix.c The ossxmix program is an example of a GUI based mixer which is the preferred way how mixer programs work. A GUI mixer will read the meta data that describes the mixer structure (tree) and the build the GUI layout based on it. GUI mixers must also be prepared to handle changes of the mixer settings caused by other mixers running at the same time.
ossmix.c The ossmix program is a simple command line based mixer program. However there should not be much need to write new command line mixers because actually ossmix already does everything that can be done.
mixext.c This is a simple program that shows how "custom" applications can make changes to the mixer settings. However programmers doing this kind of "hacks" must realize that they will be completely unportable to other systems. The names and numbers of the mixer controls depend on the device and the OSS version. They will not be the same in any other system.
mixer_applet.c Sample program that demonstrates how to create a simple mixer applet for window managers/subsystems, etc.



Copyright (C) 4Front Technologies, 2007. All rights reserved.
Back to index OSS web site