Open Sound System |
Do you have problems with sound/audio application development? Don't panic! Click here for help! |
oss_mixer_enuminfo ei;
ei.dev=mixer_device;
ei.ctrl=mixer_control_number;
ioctl(fd, SNDCTL_MIX_DESCRIPTION, &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.
Mixer device drivers may provide tooltips and help texts related with the mixer control. In such case the MIXF_DESCR bit will be set in the information returned by SNDCTL_MIX_EXTINFO.
The oss_mixer_enuminfo structure is used as the parameter. Set the dev and ctrl fields before the call. The description string will be returned in the strings field. Maximum length of the string is 3000 bytes.
The string may contain multiple lines. The first line is the "tooltip". Optional subsequent lines may contain more detailed help text. Lines are separated by a linefeed character.
This call is only available in OSS 4.1 and later. When an application is compiled under older OSS version it's necessary to use #ifdef SNDCTL_MIX_DESCRIPTION or #ifdef MIXF_DESCR around the lines of code that use this call.
Any error returned by this ioctl call mean just that there is no description text available. The application should silently ignore all errors instead of aborting or displaying an error message.
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 |