Open Sound System |
Do you have problems with sound/audio application development? Don't panic! Click here for help! |
oss_sysinfo si;
ioctl(fd, OSS_SYSINFO, &si);
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.
This call was earlier called as OSS_SYSINFO. Some older programs may still use the old name. However new applications should use SNDCTL_SYSINFO instead.
This ioctl calls can be used to obtain information about the OSS version installed in the system as well as to get the number of various devices available in the system. This information is mostly static but certain fields may change while OSS is being loaded.
This ioctl call is supported by all OSS devices, including audio, mixer and MIDI devices.
The oss_sysinfo
structure has the following fields.
Field | Purpose |
product | A string containing the name of the OSS implementation. For example "OSS/Linux". |
version | A string that returns the current OSS version number. For example "4.0.0a". This is the version of the OSS implementation that is currently running. |
license | License of the current OSS version (for example "GPL" or "CDDL"). Empty string means commercial license. |
versionnum | The API version number in numeric format. For example 0x040000 means version 4.0.0. However this version is the version of the soundcard.h file used to compile the OSS software. It's usually not the same than the version field. |
options | Reserved for future use. |
numaudios | The number of audio device files currently configured in the system. |
numaudioenginess | The number of audio engines currently configured in the system. |
openedaudio | A bit mask which tells the audio devices that are currently busy (OBSOLETE). |
numsynths | Number of synth devices. Obsolete. |
nummidis | Number of MIDI port devices available in the system. |
numtimers | Number of (MIDI) timer devices in the system. |
nummixers | Number of mixer devices available in the system. |
numcards | Number of sound cards detected in the system. See SNDCTL_CARDINFO for more info. |
openedmidi | A bit mask that tells which MIDI devices are currently busy. |
The SNDCTL_CARDINFO, SNDCTL_AUDIOINFO, SNDCTL_MIDIINFO and SNDCTL_MIXERINFO calls can be used to obtain information about the audio, MIDI and mixer devices in the system.
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.
osstest.c | The osstest program shipped with OSS |
ossinfo.c | The ossinfo program that is included in the OSS package. |
ossxmix.c | This is the ossxmix (GTK++ GUI) program shipped with OSS |
mixer_applet.c | A sample program for developing a simple mixer applet. |