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!

SNDCTL_MIX_ENUMINFO

Get choice list for a MIXT_ENUM control

Usage

oss_mixer_enuminfo ei;
ei.dev=mixer_device;
ei.ctrl=mixer_control_number;
ioctl(fd, SNDCTL_MIX_ENUMINFO, &ei);

The above code fragment lacks all error checks for clarity. Real world applications must always check for the errors and handle them as described below. Also most OSS ioctl calls will return information in the argument variable and it's usually necessary to check it too.

Description

Enumerated mixer controls (see MIXT_ENUM) normally have a list of possible choice names. This ioctl call can be used to obtain this information from the device.

It is possible that some enum controls don't have any name list available. In this case the application should automatically generate list of numbers (0 to N-1).

The oss_mixer_enuminfo structure

The oss_mixer_enuminfo structure is used by few other ioctl calls too (SNDCTL_DSP_GET_RECSRC_NAMES and SNDCTL_DSP_GET_PLAYTGT_NAMES).It has the following fields.

NameDescription
dev Mixer device number.
ctrl Mixer control number (see SNDCTL_MIX_EXTINFO).
nvalues Number of defined values (choices).
version Version number for the choice list. Version number of 0 means that the returned information is static and will not change while the program is running. Value higher than 0 means that the name list may get changed by the device. In this case the application should re-read the choice list (say) once per minute and update the GUI if the version number has changed since the last check.
strindex Table containing offsets to the strings field. For example the choice name for enum value 2 starts at ei.strings[ei.strindex[2]]. All names are normal zero terminated C language strings.
strings Buffer area for the actual strings. Indexed by strindex[].

OSS ioctl return values

The return value from the OSS ioctl calls will be -1 if a fatal error occurred. Other values mean that the ioctl call was more or less successful. However in most cases the application must check the value returned in the argument to see what was the accepted value.

Please see the Possible error codes (errno) returned by OSS calls section for more info about the error codes returned by OSS.

Sample programs

ossxmix.cThis is the ossxmix (GTK++ GUI) program shipped with OSS
ossmix.cSources for the ossmix command line mixer shipped with OSS
ossplay.cSources for the ossplay audio player and for the ossrecord
playtgt.cA sample program for play target selection
recsrc.cA sample program for recording source selection


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