Google
 

Open Sound System
OSS 4.x Programmer's Guide

Do you have problems with sound/audio application development? Don't panic! Click here for help!

SNDCTL_GETSONG

Returns the current song name (if given) related with this device

Usage

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.

Description

This ioctl call returns song name assigned to an audio or MIDI recording device. The application may show the song name in it's user interface. An empty string means that there is no song name currently assigned.

A special case of applications are software MIDI synthesisers. They read MIDI input from some source, convert it to audio and write the result to some audio device. Such applications should check if the MIDI input device has set the song name and pass it to the audio output device by calling SNDCTL_SETSONG.

An empty string means that the device supports this feature but there is currently no song name assigned. Note that the song name may change at any moment so the application using this feature should check for a new song periodically (for example every 10 seconds). If this call returns an error then there is no point in polling the name.

Related ioctl calls

You can use the SNDCTL_SETSONG ioctl can be used by the application writing to the opposite end of an audio or MIDI loopback device to set the song name.

Compatibility issues

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 getting the song name infortmation is not available. Applications should ignore errors returned by this ioctl call.

OSS ioctl return values

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.

Sample programs

softsynth_gtk.cA simple software MIDI synthesizer program with GTK GUI.


Copyright (C) 4Front Technologies, 2007. All rights reserved.
Back to index OSS web site