ObjectDescription Class

( Phonon::ObjectDescription )

The ObjectDescription class provides information about Phonon objects. 更多...

头: #include <Phonon/ObjectDescription>
Since: Qt 4.4

公共函数

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
typedef AudioOutputDevice
typedef EffectDescription
enum ObjectDescriptionType { AudioOutputDeviceType, EffectType }

详细描述

The ObjectDescription class provides information about Phonon objects.

Phonon currently uses this class to describe audio effects and audio output devices - using the typedefs AudioOutputDevice and EffectDescription . The type of an ObjectDescription is also described through the ObjectDescriptionType enum. Objects of the same type are uniquely identified by an index ().

The class gives a description () 和 name () of the object, both of which are strings appropriate for end users of a Phonon application. 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.

另请参阅 Phonon::AudioOutputDevice , Phonon::EffectDescription , Capabilities Example ,和 Phonon 模块 .

成员函数文档编制

QString ObjectDescription:: description () const

Returns a more extensive description than the name () 函数。

For example, in the case of AudioOutputDevice s, 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.

另请参阅 index ().

QString ObjectDescription:: name () const

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

另请参阅 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 被返回。

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

另请参阅 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 () 被调用。

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

另请参阅 property ().

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

返回 false 若此 ObjectDescription describes the same as otherDescription ;否则,返回 true .

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

返回 true 若此 ObjectDescription describes the same object as otherDescription ;否则,返回 false .

相关非成员

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 Effect s, which can be inserted into a media graph, altering an audio stream.

另请参阅 Phonon::ObjectDescription , Capabilities Example ,和 媒体播放器 .

enum Phonon:: ObjectDescriptionType

This enum defines the type of information that is contained in a ObjectDescription 对象。

常量 描述
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 ).