Open Sound System |
Do you have problems with sound/audio application development? Don't panic! Click here for help! |
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.
Applications like media players may use this ioctl call to assign a song name to the current audio stream. The application or device receiving the stream can display the song name or pass it ahead. Also programs like ossinfo may show the song name.
This ioctl call can be used with audio and MIDI devices. However only application writing to the stream can set the song name.
This call must be used before writing any data to the device. It's recommended to close and reopen the device if this ioctl needs to be called second time. Otherwise the application at the remote end of the link may not notice that the song name was changed.
You can use the SNDCTL_GETSONG ioctl can be used by the application reading the opposite end of an audio or MIDI loopback device to obtain the song name.
This ioctl call is new in OSS 4.0 and not supported by the freeware implementations based on older OSS versions. If this call returns errno=EINVAL then setting the song name is not possible or necessary. Applications should ignore errors returned by this ioctl call.
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.
ossplay.c | Sources for the ossplay audio player and for the ossrecord |
softsynth_gtk.c | A simple software MIDI synthesizer program with GTK GUI. |