Open Sound System
|Do you have problems with sound/audio application development? Don't panic! Click here for help!|
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.
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 is used by few other ioctl calls too (SNDCTL_DSP_GET_RECSRC_NAMES and SNDCTL_DSP_GET_PLAYTGT_NAMES).It has the following fields.
|Mixer device number.|
|Mixer control number (see SNDCTL_MIX_EXTINFO).|
|Number of defined values (choices).|
|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.|
|Table containing offsets to the |
|Buffer area for the actual strings. Indexed by |
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.
|ossxmix.c||This is the ossxmix (GTK++ GUI) program shipped with OSS|
|ossmix.c||Sources for the ossmix command line mixer shipped with OSS|
|ossplay.c||Sources for the ossplay audio player and for the ossrecord|
|playtgt.c||A sample program for play target selection|
|recsrc.c||A sample program for recording source selection|