EffectParameter Class

( Phonon::EffectParameter )

The EffectParameter class describes one parameter of an effect. 更多...

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

公共类型

enum Hint { ToggledHint, LogarithmicHint, IntegerHint }
flags Hints

公共函数

EffectParameter (const EffectParameter & other )
EffectParameter (int parameterId , const QString & name , Hints hints , const QVariant & defaultValue , const QVariant & min = QVariant(), const QVariant & max = QVariant(), const QVariantList & = QVariantList(), const QString & description = QString())
~EffectParameter ()
QVariant defaultValue () const
const QString & description () const
bool isLogarithmicControl () const
QVariant maximumValue () const
QVariant minimumValue () const
const QString & name () const
QVariantList possibleValues () const
QVariant::Type type () const
EffectParameter & operator= (const EffectParameter & other )

详细描述

The EffectParameter class describes one parameter of an effect.

You fetch the parameters of an Effect with Effect::parameters().

    QList<Phonon::EffectParameter> parameters = effect->parameters();
    foreach(Phonon::EffectParameter parameter, parameters) {
        // Do something with parameter
    }
					

To describe itself, an effect parameter gives a name () and possibly description () (depending on the backend used). These are suited to present the effect parameter to the user of a Phonon application.

Note that effects are created by the backend, and that their name and descriptions may vary.

The value of an effect parameter is stored in a QVariant , of which type () is usually int or double .

The value is retrieved with Effect::parameterValue() and set with setParameterValue() - both of which takes the EffectParameter as argument. Note that not all effect parameters support setting of their value.

You get the values a parameter can take with possibleValues (); an empty list is returned if the values are continuous.

A parameter may also specify default(), minimum(), and maximum() values. Values are returned as QVariant s. If the parameter does not have the requested value, an QVariant::Invalid invalid QVariant is returned from these functions.

The EffectWidget provides a widget with which one can control the parameters of an Effect .

    Phonon::EffectWidget *effectWidget = new Phonon::EffectWidget(effect);
					

另请参阅 Effect , EffectWidget , Capabilities Example ,和 Phonon 模块 .

成员类型文档编制

enum EffectParameter:: Hint
flags EffectParameter:: Hints

Only for backend developers:

Flags to set the return values of isToggleControl(), isLogarithmicControl (), isIntegerControl(), isBoundedBelow() and isBoundedAbove(). The values of the flags correspond to the values used for LADSPA effects.

常量 描述
Phonon::EffectParameter::ToggledHint 0x04 If this hint is set it means that the control has only two states: zero and non-zero (see isToggleControl()).
Phonon::EffectParameter::LogarithmicHint 0x10 LADSPA's SAMPLE_RATE hint needs to be translated by the backend to normal bounds, as the backend knows the sample rate - and the frontend doesn't (see isLogarithmicControl ()).
Phonon::EffectParameter::IntegerHint 0x20 See isIntegerControl().

The Hints type is a typedef for QFlags <Hint>. It stores an OR combination of Hint values.

成员函数文档编制

EffectParameter:: EffectParameter (const EffectParameter & other )

构造副本为 other effect parameter.

EffectParameter:: EffectParameter ( int parameterId , const QString & name , Hints hints , const QVariant & defaultValue , const QVariant & min = QVariant(), const QVariant & max = QVariant(), const QVariantList & = QVariantList(), const QString & description = QString())

Only to be used by backend implementations:

Creates a new effect parameter.

parameterId This is a number to uniquely identify the parameter. The id is used for value() and setValue().

name is the name/label for this parameter.

hints sets the hints for the type of parameter.

defaultValue The value that should be used as a default.

min is the minimum value allowed for this parameter. You only need to set this if the BoundedBelowHint is set.

max is the maximum value allowed for this parameter. You only need to set this if the BoundedAboveHint is set.

The parameter is the values that the effect parameter can take (only applies if non-continuous)

description is a descriptive text for the parameter (explaining what it controls) to be used as a tooltip or WhatsThis help.

EffectParameter:: ~EffectParameter ()

Destroys the effect parameter.

QVariant EffectParameter:: defaultValue () const

The default value.

const QString & EffectParameter:: description () const

The parameter may come with a description (LADSPA doesn't have a field for this, so don't expect many effects to provide a description).

The description can be used for a tooltip or WhatsThis help.

Returns A text describing the parameter.

bool EffectParameter:: isLogarithmicControl () const

Returns whether the parameter should be displayed using a logarithmic scale. This is particularly useful for frequencies and gains.

QVariant EffectParameter:: maximumValue () const

The maximum value to be used for the control to edit the parameter.

If the returned QVariant is invalid the value is not bounded from above.

QVariant EffectParameter:: minimumValue () const

The minimum value to be used for the control to edit the parameter.

If the returned QVariant is invalid the value is not bounded from below.

const QString & EffectParameter:: name () const

The name of the parameter. Can be used as the label.

Returns A label for the parameter.

QVariantList EffectParameter:: possibleValues () const

The possible values to be used for the control to edit the parameter.

if the value of this parameter is to be picked from predefined values this returns the list (otherwise it returns an empty QVariantList ).

QVariant::Type EffectParameter:: type () const

Returns the parameter type.

Common types are QVariant::Int , QVariant::Double , QVariant::Bool and QVariant::String 。当 QVariant::String is returned you get the possible values from possibleValues .

EffectParameter & EffectParameter:: operator= (const EffectParameter & other )

赋值 other effect parameter to this parameter and returns a reference to this parameter.