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_MIXERINFO

Returns information about a mixer device

Usage

oss_mixerinfo mi;
mi.dev = The mixer device number.
ioctl(fd, SNDCTL_MIXERINFO, &mi);

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

This ioctl call is supported by all OSS devices, including audio, mixer and MIDI devices. The device for which the information is returned is selected by the dev field of the argument. If dev is set to -1 then information for the current mixer device pointed by the file descriptor (fd) will be returned.

Some OSS implementations may reject the call if dev is not set to -1. For this reason it's recommended that applications open the right device directly and use -1 as the device number.

The oss_mixerinfo structure contains the following fields.

FieldDescription
dev The mixer device number. Must be set prior the call (see above).
id A short mnemonic identifier of the device.
name A string that contains the "full" descriptive name of the device.
modify_counter This integer field will be incremented every time any control under this mixer device gets changed. Applications can poll this field and perform a screen update if the value changes. However note that this field will not be incremented when controls like peak meters change their value. Controls that need to be polled regardless of the modify_counter will be marked with the MIXF_POLL flag.
card_number Number of the sound card where this device belongs or -1 if this information is not available. Applications should normally not use this field for any purpose.
port_number Usually 0. May be higher if the same card has multiple mixers. This field should not be used by applications.
magic Reserved for internal use by the utilities included in OSS.
enabled Usually 1 which means that the device is available for use. Value of 0 means that the device may have been unplugged or the driver is currently not loaded in the system. Unavailable devices cannot necessarily be opened for the time being. However they are part of the device configuration and they may become available again after few moments.
caps Mixer device capabilities (see below).
flags Reserved for internal use by OSS. Must not be used by any applications.
nrext Number of new style mixer (extension) info records available for this mixer. Use SNDCTL_MIX_EXTINFO to obtain the actual extension info records. SNDCTL_MIX_NREXT ioctl is an alternative way to get the number of mixer extensions.
priority This priority field can be used to select the "default" mixer device which is usually connected to the motherboard sound chip. The mixer device with the highest priority is the preferred mixer. If two or more devices ahare the same number then the first one should be used. Value of -2 or below means that the device must not be used as a default mixer even if it's the only mixer device in the system.
devnode This field contains the name of the device file associated with this mixer device. For example "/dev/oss/sblive0/mix0". Mixer applications usually use "/dev/mixer" so this field has very limited use.
legacy_device This field gives the old style /dev/mixer# device number related with this mixer device. This information is not necessarily up to date in all situations. Mixer applications usually use "/dev/mixer" so this field has very limited use.

Mixer device capabilities

SourceExplanation
MIXER_CAP_LAYOUT_BThe device needs nonstandard layout policy
MIXER_CAP_NARROWThe GUI for this device should be made as narrow as possible
MIXER_CAP_VIRTUALThe device is virtual (doesn't control hardware directly)

Related ioctl calls

You can use the SNDCTL_SYSINFO ioctl to find out how many mixer devices there are in the system.

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

ossinfo.cThe ossinfo program that is included in the OSS package.
ossxmix.cThis is the ossxmix (GTK++ GUI) program shipped with OSS
ossmix.cSources for the ossmix command line mixer shipped with OSS
mixer_applet.cA sample program for developing a simple mixer applet.


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