Open Sound System |
Do you have problems with sound/audio application development? Don't panic! Click here for help! |
All OSS system calls follow the familiar Posix/Unix semantics. Please look at the standard manual page (man ioctl
) for more informtion. This section will only explain some OSS related details. The error codes returned by OSS as well as their meaning will be described in the Possible error codes (errno) returned by OSS calls section.
The available ioctl call set depends on the device and the calls will be described in the chapters for each device type. All ioctl calls are non-blocking ones except few exceptions that are used to wait until the device has played all of the data written to it.
Some of the ioctl calls have no parameters at all. However most of them have one parameter that is a pointer to an integer variavle or to some structure. The function return of the ioctl() system call has no defined meaning. However return value of -1 means that an error has occurred. In that case the errno system variable will contain the exact error code (see above).
Even if the ioctl call didn't return error it's necessary to check the argument value to see if the device accepted the requested value. Many ioctl calls will use the nearest possible value of the one requested by the application was not supported. For example if an application requests sampling rate of 44000 Hz the device may change it to 44100 Hz. It's responsibility of the application to check if the returned value is suitable for it's purposes.
Most ioctl calls will return only when the application did something seriously wrong. Another reason to an error is that the device is not working properly. If a minor error occurred the ioctl call will just silently modify the argument to the value being actually used.
With OSS the return value of ioctl() is used only for error reporting. The return value has no defined meaning when the call was successful (and it will be 0 in most cases). Applications that use the ioctl return value are likely to fail under different OSS implementations.
Source | Explanation |
SNDCTL_DSP_BIND_CHANNEL | Route stereo output to the specified channels (obsolete) |
SNDCTL_DSP_CHANNELS | Set the number of audio channels |
SNDCTL_DSP_COOKEDMODE | Disable/enable the "on fly" format conversions made by the OSS software |
SNDCTL_DSP_CURRENT_IPTR | Returns the current recording position |
SNDCTL_DSP_CURRENT_OPTR | Returns the current playback position |
SNDCTL_DSP_GETBLKSIZE | Get the current fragment size (obsolete) |
SNDCTL_DSP_GETCAPS | Returns the capabilities of an audio device |
SNDCTL_DSP_GETCHANNELMASK | Returns the bindings supported by the device (obsolete) |
SNDCTL_DSP_GET_CHNORDER | Get the channel ordering of a multi channel device |
SNDCTL_DSP_GETERROR | Returns audio device error information |
SNDCTL_DSP_GETFMTS | Returns a list of natively supported sample formats |
SNDCTL_DSP_GETIPEAKS | The peak levels for all recording channels |
SNDCTL_DSP_GETIPTR | Returns the current recording pointer (obsolete) |
SNDCTL_DSP_GETISPACE | Returns the amount of recorded data that can be read without blocking. |
SNDCTL_DSP_GETODELAY | Returns the playback buffering delay |
SNDCTL_DSP_GETOPEAKS | The peak levels for all playback channels |
SNDCTL_DSP_GETOPTR | Returns the current playback pointer (obsolete) |
SNDCTL_DSP_GETOSPACE | Returns the amount of playback data that can be written without blocking. |
SNDCTL_DSP_GET_PLAYTGT_NAMES | Returns labels for the currently available output routings |
SNDCTL_DSP_GET_PLAYTGT | Returns the current output routing |
SNDCTL_DSP_GETPLAYVOL | Returns the current audio playback volume |
SNDCTL_DSP_GET_RECSRC_NAMES | Returns labels for the currently available recording sources |
SNDCTL_DSP_GET_RECSRC | Returns the current recording source |
SNDCTL_DSP_GETRECVOL | Returns the current audio recording level |
SNDCTL_DSP_GETTRIGGER | Returns the current trigger bits (obsolete) |
SNDCTL_DSP_HALT_INPUT | Aborts audio recording operation |
SNDCTL_DSP_HALT_OUTPUT | Aborts audio playback operation |
SNDCTL_DSP_HALT | Aborts audio recording and/or playback operation |
SNDCTL_DSP_LOW_WATER | Sets the trigger treshold for select() |
SNDCTL_DSP_NONBLOCK | Force non-blocking mode |
SNDCTL_DSP_POLICY | Sets the timing policy of an audio device |
SNDCTL_DSP_POST | Forces audio playback to start (obsolete) |
SNDCTL_DSP_READCTL | Reads the S/PDIF interface status. |
SNDCTL_DSP_SAMPLESIZE | Sets the sample size (obsolete) |
SNDCTL_DSP_SETDUPLEX | Turns on the duplex mode |
SNDCTL_DSP_SETFMT | Select the sample format |
SNDCTL_DSP_SETFRAGMENT | Sets the buffer size hint |
SNDCTL_DSP_SET_PLAYTGT | Sets the current output routing |
SNDCTL_DSP_SETPLAYVOL | Changes the current audio playback volume |
SNDCTL_DSP_SET_RECSRC | Sets the current recording source |
SNDCTL_DSP_SETRECVOL | Changes the current audio recording level |
SNDCTL_DSP_SETSYNCRO | Slaves the audio device to the /dev/sequencer driver (obsolete) |
SNDCTL_DSP_SETTRIGGER | Starts audio recording and/or playback in sync |
SNDCTL_DSP_SILENCE | Clears the playback buffer with silence |
SNDCTL_DSP_SKIP | Discards all samples in the playback buffer |
SNDCTL_DSP_SPEED | Set the sampling rate |
SNDCTL_DSP_SUBDIVIDE | Requests the device to use smaller fragments (obsolete) |
SNDCTL_DSP_SYNCGROUP | Creates a synchronization group. |
SNDCTL_DSP_SYNC | Suspend the application until all samples have been played |
SNDCTL_DSP_SYNCSTART | Starts all devices added to a synchronization group. |
SNDCTL_DSP_WRITECTL | Alters the S/PDIF interface setup. |
Source | Explanation |
SNDCTL_MIX_DESCRIPTION | Get description text for a mixer control |
SNDCTL_MIX_ENUMINFO | Get choice list for a MIXT_ENUM control |
SNDCTL_MIX_EXTINFO | Get a mixer extension descriptor. |
SNDCTL_MIX_NREXT | Get number of mixer extension descriptor records |
SNDCTL_MIX_NRMIX | Get number of mixer devices in the system |
SNDCTL_MIX_READ | Read the current value of a mixer control |
SNDCTL_MIX_WRITE | Change value of a mixer control |
Source | Explanation |
midi_timing | Using the timed mode MIDI interface |
SNDCTL_MIDI_EXPRESS_WRITE | Inserts MIDI messages to the beginning of the device output buffer. |
SNDCTL_MIDI_INFO | Get information about a MIDI device (OBSOLETE) |
SNDCTL_MIDI_MPUCMD | Obsolete ioctl call |
SNDCTL_MIDI_MPUMODE | Obsolete ioctl call |
SNDCTL_MIDI_MTCINPUT | Turn on MTC input mode |
SNDCTL_MIDI_PRETIME | Set the pre character wait time. |
SNDCTL_MIDI_SETMODE | Set the interface mode |
Source | Explanation |
OSS_GETVERSION | Returns the OSS API version number of current system |
SNDCTL_AUDIOINFO | Return information about an audio device |
SNDCTL_CARDINFO | Returns information about a sound card or pseudo device |
SNDCTL_GETLABEL | Returns label assigned to this device |
SNDCTL_GETSONG | Returns the current song name (if given) related with this device |
SNDCTL_MIDIINFO | Returns information about a MIDI device |
SNDCTL_MIXERINFO | Returns information about a mixer device |
SNDCTL_SETLABEL | Sets the label for this device |
SNDCTL_SETNAME | Sets the name of this device (if changeable) |
SNDCTL_SETSONG | Sets the song name related with this device. |
SNDCTL_SYSINFO | Return information about OSS and the devices |