|  | Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# ObjectDescription Class Reference
(Phonon::ObjectDescription)
[Phonon module]

The ObjectDescription class provides a generic interface to information about Phonon objects. Author: Matthias Kretz <kretz@kde.org> More...

     #include <Phonon>

This class was introduced in Qt 4.4.

- List of all members, including inherited members

### Public Functions

- ObjectDescription ()
- ObjectDescription ( int index, const QHash<QByteArray, QVariant> & properties )
- QString description () const
- int index () const
- bool isValid () const
- QString name () const
- QVariant property ( const char * name ) const
- QList<QByteArray> propertyNames () const
- bool operator!= ( const ObjectDescription & otherDescription ) const
- bool operator== ( const ObjectDescription & otherDescription ) const

### Related Non-Members

- typedef AudioOutputDevice
- typedef EffectDescription
- enum ObjectDescriptionType { AudioOutputDeviceType, EffectType }

## Detailed Description

The ObjectDescription class provides a generic interface to information about Phonon objects. Author: Matthias Kretz <kretz@kde.org>

Phonon currently uses this class to describe audio effects and audio output devices - using the typedefs AudioOutputDevice and EffectDescription.

The class gives a description() and a name() of the object, both of which are strings appropriate for end users of a Phonon application. Objects of the same type is uniquely identified by an index().

You can also check whether the device or effect described is valid. This does not guarantee that the device or effect functions as expected, but that the ObjectDescription describes an existing device or effect.

Audio output devices and effect descriptions are used to select the audio output device to be used for playback and to create effects; we show examples of this in the snippet below. The available descriptions can be fetched with availableAudioOutputDevices() and availableAudioEffects() static functions in the Phonon::BackendCapabilities namespace

         QList<Phonon::EffectDescription> effectDescriptions =
                 Phonon::BackendCapabilities::availableAudioEffects();

         QList<Phonon::AudioOutputDevice> audioOutputDevices =
                 Phonon::BackendCapabilities::availableAudioOutputDevices();

         foreach (Phonon::EffectDescription effectDescription, effectDescriptions) {
             Phonon::Effect *effect = new Phonon::Effect(effectDescription);

             // ... Do something with the effect, like insert it into a media graph
         }

         Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput;

         audioOutput->setOutputDevice(audioOutputDevices[0]);

Other types of ObjectDescriptions might be possible in the future, e.g., descriptions of audio capture devices, such as microphones.

See also Phonon::AudioOutputDevice, Phonon::EffectDescription, and Capabilities Example.

## Member Function Documentation

### ObjectDescription::ObjectDescription ()

constructs a new object description.

### ObjectDescription::ObjectDescription ( int index, const QHash<QByteArray, QVariant> & properties )

### QString ObjectDescription::description () const

Returns a more extensive description than the name() function.

For example, in the case of AudioOutputDevices, this text should make clear which sound source is described; this is sometimes hard to describe or understand from just the name.

The text is appropriate to present to an end user in for example tool tips of items, with the name()'s as text, in a QComboBox.

### int ObjectDescription::index () const

Returns a unique identifier for this ObjectDescription. Used internally to distinguish between the descriptions.

Notice that the identifiers are only unique to the type of description, e.g., AudioOutputDevice or EffectDescription.

### bool ObjectDescription::isValid () const

Returns true if the device or effect described exists.

An ObjectDescription that is invalid, will also have an index() of -1.

See also index().

### QString ObjectDescription::name () const

Returns a string appropriate for a user to select between object descriptions, e.g., from a QComboBox.

See also description().

### QVariant ObjectDescription::property ( const char * name ) const

Returns the property named name. A property can be used for extended information, such as the manufacturer of a sound card. The information will usually be given as text.

If the property is not set an invalid QVariant is returned.

Qt's backends do not use properties at the time of this writing.

See also propertyNames().

### QList<QByteArray> ObjectDescription::propertyNames () const

Properties can be used for extended information about a ObjectDescription, e.g., a manufacturer of a sound card. The information will usually be given text.

This function returns all names that return valid data when property() is called.

Currently, Qt backends do not use properties for their object descriptions.

See also property().

### bool ObjectDescription::operator!= ( const ObjectDescription & otherDescription ) const

Returns `false` if this ObjectDescription describes the same as otherDescription; otherwise, returns `true`.

### bool ObjectDescription::operator== ( const ObjectDescription & otherDescription ) const

Returns `true` if this ObjectDescription describes the same object as otherDescription; otherwise, returns `false`.

## Related Non-Members

### typedef Phonon::AudioOutputDevice

This typedef of ObjectDescription describes an audio output device, such as soundcards (with different drivers), sound servers, or other virtual outputs like playback on a different computer on the network.

A list of available devices is given by the backend with Backendcapabilities::availableAudioOutputDevices()

         QList<Phonon::AudioOutputDevice> audioOutputDevices =
                 Phonon::BackendCapabilities::availableAudioOutputDevices();

### typedef Phonon::EffectDescription

EffectDescription gives a description of an audio effect. It is a typedef of the ObjectDescription class. Please see its class description for details.

EffectDescription is used to create audio Effects, which can be inserted into a media graph, altering an audio stream.

See also Phonon::ObjectDescription, Capabilities Example, and Media Player.

### enum Phonon::ObjectDescriptionType

This enum defines the type of information that is contained in a ObjectDescription object.

Constant | Value | Description
--- | --- | ---
`Phonon::AudioOutputDeviceType` | `0` | An audio output device (AudioOutputDevice). This can be soundcards (with different drivers), sound servers, or other virtual outputs like playback on a different computer on the network.
`Phonon::EffectType` | `1` | An audio effect (EffectDescription).