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_SETNAME

Sets the name of this device (if changeable)

Usage

oss_longname_t name;
strcpy(name, "Acme super audio server";
ioctl(fd, SNDCTL_SETNAME, name);

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

Some virtual drivers (such as the audio and MIDI loopback drivers) may let the application using the device to change the device name. For example the application using the serv er side of an audio or MIDI loopback device (pipe) may give a more descriptive name to the device (for example "Acme super modelling synth"). Applications using the client side may then show this name (instead of the generic default name) when the user selects the audio/MIDI device(s) to use.

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.

Related ioctl calls

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 any error then the device name cannot be changed. The application should not show an error message if this happens.

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