1
/*  This file is part of the KDE project.
2
3
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4
5
This library is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 2.1 or 3 of the License.
8
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
GNU Lesser General Public License for more details.
13
14
You should have received a copy of the GNU Lesser General Public License
15
along with this library.  If not, see <http://www.gnu.org/licenses/>.
16
17
*/
18
19
#ifndef PHONON_MMF_EFFECTFACTORY_H
20
#define PHONON_MMF_EFFECTFACTORY_H
21
22
#include "abstractaudioeffect.h"
23
#include "effectparameter.h"
24
25
QT_BEGIN_NAMESPACE
26
27
namespace Phonon
28
{
29
namespace MMF
30
{
31
32
/**
33
 * @short Contains utility functions related to effects.
34
 */
35
class EffectFactory : public QObject
36
{
37
    Q_OBJECT
38
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
55
    /**
56
     * @short Creates an audio effect of type @p type.
57
     */
58
    AbstractAudioEffect *createAudioEffect(Type type, QObject *parent);
59
60
    /**
61
     * @short Return the properties for effect @p type.
62
     *
63
     * This handles the effects for
64
     * BackendInterface::objectDescriptionProperties().
65
     */
66
    QHash<QByteArray, QVariant> audioEffectDescriptions(Type type);
67
68
    /**
69
     * @short Returns the indexes for the supported effects.
70
     *
71
     * This handles the effects for
72
     * BackendInterface::objectDescriptionIndexes().
73
     */
74
    QList<int> effectIndexes();
75
76
private:
77
    void initialize();
78
79
    struct EffectData
80
    {
81
        bool                            m_supported;
82
        QHash<QByteArray, QVariant>     m_descriptions;
83
        QList<EffectParameter>          m_parameters;
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
93
};
94
95
}
96
}
97
98
QT_END_NAMESPACE
99
100
#endif