src/3rdparty/phonon/mmf/effectfactory.h
changeset 18 2f34d5167611
parent 0 1918ee327afb
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
    18 
    18 
    19 #ifndef PHONON_MMF_EFFECTFACTORY_H
    19 #ifndef PHONON_MMF_EFFECTFACTORY_H
    20 #define PHONON_MMF_EFFECTFACTORY_H
    20 #define PHONON_MMF_EFFECTFACTORY_H
    21 
    21 
    22 #include "abstractaudioeffect.h"
    22 #include "abstractaudioeffect.h"
       
    23 #include "effectparameter.h"
    23 
    24 
    24 QT_BEGIN_NAMESPACE
    25 QT_BEGIN_NAMESPACE
    25 
    26 
    26 namespace Phonon
    27 namespace Phonon
    27 {
    28 {
    29 {
    30 {
    30 
    31 
    31 /**
    32 /**
    32  * @short Contains utility functions related to effects.
    33  * @short Contains utility functions related to effects.
    33  */
    34  */
    34 class EffectFactory
    35 class EffectFactory : public QObject
    35 {
    36 {
       
    37     Q_OBJECT
       
    38 
    36 public:
    39 public:
       
    40     EffectFactory(QObject *parent);
       
    41     ~EffectFactory();
       
    42 
       
    43     enum Type
       
    44     {
       
    45         TypeAudioEqualizer = 0
       
    46     ,   TypeBassBoost
       
    47     ,   TypeDistanceAttenuation
       
    48     ,   TypeEnvironmentalReverb
       
    49     ,   TypeListenerOrientation
       
    50     ,   TypeLoudness
       
    51     ,   TypeSourceOrientation
       
    52     ,   TypeStereoWidening
       
    53     };
       
    54 
    37     /**
    55     /**
    38      * @short Creates an audio effect of type @p type.
    56      * @short Creates an audio effect of type @p type.
    39      */
    57      */
    40     static AbstractAudioEffect *createAudioEffect(AbstractAudioEffect::Type type,
    58     AbstractAudioEffect *createAudioEffect(Type type, QObject *parent);
    41                                                   QObject *parent);
       
    42 
    59 
    43     /**
    60     /**
    44      * @short Return the properties for effect @p type.
    61      * @short Return the properties for effect @p type.
    45      *
    62      *
    46      * This handles the effects for
    63      * This handles the effects for
    47      * BackendInterface::objectDescriptionProperties().
    64      * BackendInterface::objectDescriptionProperties().
    48      */
    65      */
    49     static QHash<QByteArray, QVariant> audioEffectDescriptions(AbstractAudioEffect::Type type);
    66     QHash<QByteArray, QVariant> audioEffectDescriptions(Type type);
    50 
    67 
    51     /**
    68     /**
    52      * @short Returns the indexes for the supported effects.
    69      * @short Returns the indexes for the supported effects.
    53      *
    70      *
    54      * This handles the effects for
    71      * This handles the effects for
    55      * BackendInterface::objectDescriptionIndexes().
    72      * BackendInterface::objectDescriptionIndexes().
    56      */
    73      */
    57     static QList<int> effectIndexes();
    74     QList<int> effectIndexes();
    58 
    75 
    59 private:
    76 private:
    60     static inline QHash<QByteArray, QVariant> constructEffectDescription(const QString &name,
    77     void initialize();
    61                                                                          const QString &description);
       
    62 
    78 
    63     /**
    79     struct EffectData
    64      * This class is not supposed to be instantiated, so disable
    80     {
    65      * the default constructor.
    81         bool                            m_supported;
    66      */
    82         QHash<QByteArray, QVariant>     m_descriptions;
    67     inline EffectFactory();
    83         QList<EffectParameter>          m_parameters;
    68     Q_DISABLE_COPY(EffectFactory)
    84     };
       
    85 
       
    86     template<typename BackendNode> EffectData getData();
       
    87     const EffectData& data(Type type) const;
       
    88 
       
    89 private:
       
    90     bool                                m_initialized;
       
    91     QHash<Type, EffectData>             m_effectData;
       
    92 
    69 };
    93 };
       
    94 
    70 }
    95 }
    71 }
    96 }
    72 
    97 
    73 QT_END_NAMESPACE
    98 QT_END_NAMESPACE
    74 
    99